I’ve decided to use a non-kinematic rigidbody for the vehicles in my game. Just to note, they are secondary to the main game (which takes place on the rooftops of nearby buildings).
I have traffic nodes littered throughout the streets to direct the vehicles where to go. Some of these nodes represent stop signs (they’ll cause the vehicle to come to a stop for a few seconds before casting a ray and then proceeding to turn), while others are controlled by traffic lights.
I need the vehicles to be able to collide with each other, nearby buildings (drivers may be startled and simply veer off road into buildings, trees, etc), and other debris that may have inadvertently fallen into the road (aka imagine the player shooting down scaffolding on top of a building).
My question, plain and simple, is: having described my needs above, what is the best way to move my vehicles so they move smoothly, accurately (aka easy for me to have turn and follow roads without veering into other lanes), and react to physics objects and possibly explode?
I’m not entirely sure how I want to handle vehicles turning. I was thinking of maybe using a curve and just interpolating them along the curve until the end, at which point they continue their normal driving behavior, moving along to the next node down the street. Of course, deciding now to use rigidbodies throws a possible fork in that plan also, since I’m unsure how to move rigidbodies!
If anyone can share some educated opinions and suggestions, I’d greatly appreciate it! If there are any caveats, please share those also, I’m really trying to write a fairly clean but robust system but I have limited-to-no experience using physics!
edit - Also, I understand the FixedUpdate happens less frequently, which could result in jitter…but using rigidbodies, and possibly AddForce, is FixedUpdate a better spot to move the vehicles? Is AddForce a good option? I need to be able to tell if/when the vehicles should come to a stop so they don’t overshoot stop signs…and how on Earth would I simulate breaking so they don’t stop on a dime but end up at 0mph at the point they need to be??