I have a vehicle following a path down a road towards a roundabout. I would like the vehicle to slow down and stop before entering the roundabout as if waiting for traffic. I know you can make trigger boxes to slow a cars velocity down, but I’m not at the point where I know what code to use on the trigger box. Any Help would be appreciated. Thank you.
1 Answer
1Create a box and turn off it’s mesh. If it has a collider then make sure that its isTrigger box is checked. If it doesn’t have a collider give it one and check the isTrigger box.
Then add a script like this:
To where the line that says:
Destroy(other.gameObject);
will now say:
other.gameObject.YourMovementScript.speed() = int slowerSpeed;
And whenever the car enters the (now invisible box) it will slow down.