I have multiple instances of a Sprite with the physics behavior flying around my screen.

I just want the sprite to face the direction it is travelling in.

I have tried setting angle of the object to Angle(0,0,Object.Physics.VelocityX,Object.Physics.velocityY) in the Every tick event. I have also tried similar with a For each Object in the Every Tick event.

Results can be seen in the project file, seems weird to me.

But, remember that the point 0,0 is the top left corner of your screen. So you are continuously calculating the angle from there.

VelocityX should be the magnitude of the velocity in that direction, as with VelocityY. Calculating an angle based on the origin (top left corner) and the magnitude of the velocity is sure to cause some strange results isn't it?

But, remember that the point 0,0 is the top left corner of your screen. So you are continuously calculating the angle from there.

VelocityX should be the magnitude of the velocity in that direction, as with VelocityY. Calculating an angle based on the origin (top left corner) and the magnitude of the velocity is sure to cause some strange results isn't it?

As I understand it:

The velocity is just a coordinate position relative to the current position. It can be negative.

So the position of an object in the next step using velocity is just x+Vx, y+Vy. So if you calculate the angle from 0,0 using Vx and Vy is should be the correct direction?

The problem was GravityPhysics is a family behavior, so it seemed to be getting the wrong velocity values so I used superkews solution using instance variables instead of globals.

If anyone knows how to target the correct instance of that behavior I would be very greatful.

I like your solution to get the angle using the velocity. It is definitely more elegant. I'm at my day job, which is a different thought process to game dev, so I do feel a bit slow.

I think I will try it out in my game and see if it yields the same results.