- Home /
Physics2D and curved movement
Say we want to move a unit from one place to other. If it turns its front first then we can use addforce to move it there then set velocity to zero.
What if we want it to start moving and at the same time rotating to its target, following a curved path. With addforce, my attempts mostly lead to the object drifting away while moving, and abusing addforce in update function etc. Physics2d not having addrelativeforce kind of functions, I couldn't figure out what to do. Any help is appreciated, thanks!
Edit: Also no matter how much force you apply, with one call of addforce 2d objects of same mass move at a certain slow speed, making you apply the force more than one times.
Answer by HappyMoo · Jan 04, 2014 at 05:49 PM
If you're drifting off too much, your turnspeed is too slow for your drinving speed, if that makes sense. Just turn faster.
Also, this is basically car physics, so depending on how fast you turn, you might get in the situation that you can't reach your target, but drive circles around it and you have to handle this somehow.
You could just stop when you are close or you can increase your turnspeed once you get close etc..
and instead of using addforce, I would recommend to set the velocity for a smoother experience
Your answer
Follow this Question
Related Questions
Following Mouse Motion 1 Answer
Stopped Rigidbody2D still applying motion to carried objects? 0 Answers
How to create a Path 1 Answer
collider vertices too close? 1 Answer
Circle colliders and polygon colliders 2 Answers