How to make the car stop only on the green lane, only on the green block during the delay
This semaphore needs to be duplicated several times.
No matter how far away from the semafaro.
The car must first stop at the green block.
Cannot exceed red block until delay expires
CarExemploDelay.blend (917.0 KB)
Sorry for my English"
as often, bad English doesn’t come alone. hard to understand what you are trying to ask
I remade your .blend with more simple logics : the car hits the green block (set on ghost) , then waits 20 frames before starting to move again to the next green block. I removed the wheels because you don’t need them to solve your problem
For the red block, i really don’t understand what you want from it.
CarExemploDelay.blend (542.2 KB)
Thanks! haha i use google translator i’m not american
The simulated red block or traffic light. I am creating an artificial intelligence of cars.
You could help me? create you are very good at logic.
I need all the help I can
well, you need to be extremely clear in your questions or sub-divide your question into small and precise ones.
I was guessing your question because i had a look on your .blend
you still didn’t explain what you are expecting from the red lights. You don’t need them , traffic lights are on 1 spot (green light switch to red light), no ?
Also, if you make AI car simulator, you don’t need Physics and Rigid bodies. But you should use python in any cases
Or if you really want physics, you should start with something like this
This is my car , still need to work on it
EDIT : last thing, try to avoid pulse mode when you are trying to design your game logics. It might make your system look working overall, but in reality it could be a mess and bugs will show up later once your system will become more complex. Pulse mode is a lazy bad habit and can slow down your game.
I already have ready physics car.
I added radars in front of him for when one of the radars collides he turns both ways.
when the colliding radar decreases. but I have no idea how to do
but I would like it this way. example in the video:https://www.youtube.com/watch?v=gnfkfUQvKDw&t=189s.
2:04/2:18 minutes of videos
You see that there are 4 radars in the car: >Test radars.mp4 But they are static do not diminish
at this point you will need python if you want to keep your logics simple.
- You may want to use this function to get hit position of a ray from your car ( ‘obj’ ) to a wall ( which has ‘property’ ) . Hit position - Origin = a Vector (x,y,z) . Thus, you will get as many vectors as you create rays ( 2 to 8 is enough)
##get GameObject, hit position and angle.
hit = obj.rayCast( to, from, distance, property, face, xray, poly)
then compute a vector ( ‘vect’) direction you want your car to go (turn left or right). You can do this a bit like you want. The simplest , is to take the biggest vector among the 8 (= just go in the direction where there’s more space)
then you need this function to tell your car to be aligned on ‘vect’ , ‘axis’ to say which vector of ‘obj’ as to be aligned (often the “Y” axis) and ‘fac’ (0.0 to 1.0) the %
obj.alignAxisToVect(vect, axis, fac)
I don’t have time to do it, so try yourself in a first time. I can do it this week-end or maybe someone else will do it for you meanwhile.
Last thing, forget about “AI” , AI is just a meme, it’s just a compilation of geometrical measures, statistics , numerical measures and algorithms. Everything implemented by humans in a code read by the so called “AI”