How do I check a physics object's velocity at an angle

Get help using Construct 2

Post » Thu Jul 27, 2017 2:00 pm

Hey there, I want to check if a physics object's velocity at an angle is greater than X, but in C2 I only found the option to do this only on the X or Y axis...

I know there must be some way of finding it out by using the separate X and Y velocities and applying some mathematical equation, but math was never my strong point =D
ImageImageImageImage
B
30
S
9
G
7
Posts: 262
Reputation: 5,646

Post » Thu Jul 27, 2017 5:28 pm

You can use a dot product to get that:

cos(angle)*sprite.physics.velocityX + sin(angle)*sprite.physics.velocityY
B
94
S
33
G
118
Posts: 5,394
Reputation: 75,849

Post » Thu Jul 27, 2017 10:01 pm

R0J0hound wrote:You can use a dot product to get that:

cos(angle)*sprite.physics.velocityX + sin(angle)*sprite.physics.velocityY

Awesome, thank you very much!
ImageImageImageImage
B
30
S
9
G
7
Posts: 262
Reputation: 5,646


Return to How do I....?

Who is online

Users browsing this forum: zooes and 7 guests