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: 250
Reputation: 5,612

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
92
S
32
G
110
Posts: 5,295
Reputation: 71,501

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: 250
Reputation: 5,612


Return to How do I....?

Who is online

Users browsing this forum: Artcadev, brunopalermo, Euduardo, Jackriduk, Yahoo [Bot] and 29 guests