Set angle to physics angle of motion.

Get help using Construct 2

Post » Mon Jun 09, 2014 3:00 am

Hi there. So I was wondering about this for a while, how do I set the angle of an object to it's angle of motion?
I have the feeling that it would be:
tan(a) = y/x
∴ tan(velY/velX)^(-1) = a
But that doesn't seem to work very well at all, possibly due to being negative or positive, I'm not sure. There's also the x ≠ 0 problem. I would think then that it would be tan(abs(velY)/(abs(velX) + 0.0001)) = a or something but I'm hesitant to try that one out.

I'd rather not learn how to deal with vector, but if it comes to that, oh well.
B
42
S
14
G
3
Posts: 165
Reputation: 5,115

Post » Mon Jun 09, 2014 5:55 am

I think the expression you wanted to do was:
atan(velY/velX) = a

But it will have issues with pos/neg in some quadrants, but fortunately you can just do this:
angle(0,0,velX,velY)
B
91
S
31
G
102
Posts: 5,232
Reputation: 67,250

Post » Mon Jun 09, 2014 7:19 am

Thanks so much! I'm not entirely sure how, but it works, and it's awesome.
B
42
S
14
G
3
Posts: 165
Reputation: 5,115


Return to How do I....?

Who is online

Users browsing this forum: MaxxMunnn, newt and 5 guests