How do I get physics speed.

Get help using Construct 2

Post » Thu Aug 14, 2014 12:54 pm

Ive been trying to make radial gravity. I cant make normal gravitational pull that would work realistic. I use Force to make gravity on planet. What I'm trying to do is this:
Object enters slowly into planets atmosphere and gets pulled towards planet, the faster it moves the bigger the force is. I tried using formula like this for Force: 100/distance(object.x ,object.y, planet.x , planet,y), but what i want is something like this: 100/distance(object.x ,object.y, planet.x , planet,y)*fallspeed. How can i get physics object speed?
B
6
Posts: 17
Reputation: 276

Post » Thu Aug 14, 2014 1:06 pm

In the manual it says VelocityX and VelocityY, but maybe I read it wrong..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Aug 14, 2014 2:30 pm

It works only if you have one direction of gravity. And velocity is not speed :/
B
6
Posts: 17
Reputation: 276

Post » Thu Aug 14, 2014 2:44 pm

Velocity is not speed?
Hmm, the Manual says it is:

VelocityX
VelocityY
The current speed of the physics object, in pixels per second.

So VelocityX is the speed in pixels per second in the horizontal direction
VelocityY is the speed in pixels per second in the vertical direction

Simply a matter of combining the two vectors to get your direction
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Aug 14, 2014 3:09 pm

Thanks, I just thought if you combine X Y, If you fall from different angle than 90 results would be different
B
6
Posts: 17
Reputation: 276

Post » Thu Aug 14, 2014 5:06 pm

As a note you get the speed from velocityX and velocityY with this calculation:
speed = distance(0,0,velocityX,velocityY)

or
speed = sqrt(velocityX^2 + velocityY^2)

which is the same, just whatever you prefer.
B
92
S
32
G
107
Posts: 5,273
Reputation: 69,957


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 19 guests