I’m trying to get an object moving with a rigid body. I’m using .applyForce and applyImpulse. Now, unless my eyes are lying to me, which very well may be the case, both those methods look the keep adding the force to my object and it keeps speeding up faster and faster. I just need a consistent speed
code in the update function looks like
this.entity.rigidbody.applyImpulse(1, 0, 0);
or
this.entity.rigidbody.applyForce(1, 0, 0);
Not sure what I am doing wrong, thank you for any help.
Does this object need to react to others touching it, or just move as an unstoppable the affects others? If it’s the latter, you can just change the rigidbody type to kinematic and use setPosition() or setLocalPosition() as you would any other object.
Just a little more detail incase anyone else has the same question… the code in general is for NPC vehicles. They just drive around the city. The collisions spots live in intersections and tell the vehicles which way they can turn.
Here’s what I have so far. Feel free to ask questions or offer suggestions Works pretty good, but every now and then the cars bunch up at an intersection.
You can reload the page and get a new random “city” layout.
Unfortunately, we are unable to see the launch page of your project if your project is private. You can show your progress by sharing a link of a build.