Set the angle/rotation to the direction the object is moving

So, I’m moving this object with applyForce, but I can’t figure out how to set the angle on it so that it points towards the direction it’s moving. I’ve found a few threads about the opposite, moving in the angles direction, but that’s not really what I’m looking for.
Any help is appreciated! [import]uid: 13180 topic_id: 8534 reply_id: 308534[/import]

I found a solution, so I thought I should share it here in case someone else is having the same problem:

[code]
–get the direction in which the object is moving
vx, vy = block:getLinearVelocity()

–angle in radians
velocityAngle = math.atan2( vy, vx)

–angle in degrees
velocityAngle = math.deg(velocityAngle)

–offset in degrees - might need to be changed depending on your object/image rotation
offset = 90
block.rotation = velocityAngle + offset

[/code] [import]uid: 13180 topic_id: 8534 reply_id: 30618[/import]