[SOLVED] How to get the direction of an rotating moving entity?


#1

I have an entity which is rotating with angular velocity 1 and moving in a direction with some linear velocity in Y-axis, So when the entity stops I want to show a directional arrow to it. Can you please help me how to do it?


#2

I think you need to give more detail here. I mean, for any entity, you can get its direction from its forward vector, say.

this.entity.forward

Or if you need to get the direction of a point to your entity, you just subtract the point from the position of the entity and that’s the direction vector.

Maybe you should draw a diagram to explain further if this didn’t help.


#3

Hello, @will Thank you for replying:), Actually, I have got my issue resolved, My entity was rotating as the earth does and it was moving in straight line. So I had to stop it at some point and needed to show an arrow in the direction of the entity was moving. So I used the linear velocity and found the direction using
Math.atan(y/x) So, I got the angle and added the arrow using Euler angles method :slight_smile:
Thank you for providing forums :slight_smile:

Thanks