Saturday, December 30, 2017

physics - How do I set angular velocity/torque so that it's pointing to velocity/direction?


Right now, when I spawn a shootable object, it goes like this:



enter image description here


Because I just set it's angle to this:


float aimAngle = (float) Math.atan2(velocity.y, velocity.x);
bullet.setBodyAngle(aimAngle);

I want it to be like this:


enter image description here


I think I should use angular velocity or torque, but I have no idea how. I can't just set it's angle like in previous code every frame, because it makes physics collisions glitch.




No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...