(S)How do I set physics object's gravity orientation

Get help using Construct 2

Post » Sat Apr 29, 2017 5:51 pm

Hey, I want it when I press the up arrow to make the gravity be upward instead of downward, left arrow to make it go leftward and so on.

How can I do this?
Last edited by TRMG on Tue May 23, 2017 9:01 am, edited 1 time in total.
ImageImageImageImage
B
27
S
9
G
7
Posts: 229
Reputation: 5,493

Post » Sat Apr 29, 2017 8:18 pm

You can't change the angle of gravity with physics, other then setting world gravity for say 10 to -10 would do up and down but no left and right.

This may help you though, it's setting impulse in the chose direction to simulate gravity.

http://s000.tinyupload.com/?file_id=805 ... 2220495075
B
22
S
6
G
1
Posts: 30
Reputation: 1,379

Post » Sat Apr 29, 2017 8:56 pm

higher2003 wrote:You can't change the angle of gravity with physics, other then setting world gravity for say 10 to -10 would do up and down but no left and right.

This may help you though, it's setting impulse in the chose direction to simulate gravity.

http://s000.tinyupload.com/?file_id=805 ... 2220495075

This seems like a good solution, but is there a way to set a maximum on that force?
Because right now it seems to be getting faster and faster as time goes on which is not quite how gravity works...

Thanks!
ImageImageImageImage
B
27
S
9
G
7
Posts: 229
Reputation: 5,493

Post » Sat Apr 29, 2017 10:28 pm

You could try setting it so it only applys the impulse if the sprite is moving below a certain speed,
Something like..

[ sprite.physics.overallvelocity < 100 ] Apply impulse 1 at X angle
B
22
S
6
G
1
Posts: 30
Reputation: 1,379

Post » Sat Apr 29, 2017 11:13 pm

higher2003 wrote:You could try setting it so it only applys the impulse if the sprite is moving below a certain speed,
Something like..

[ sprite.physics.overallvelocity < 100 ] Apply impulse 1 at X angle

There doesn't seem to be an overall velocity attribute...
ImageImageImageImage
B
27
S
9
G
7
Posts: 229
Reputation: 5,493

Post » Sun Apr 30, 2017 12:05 am

and event, double click the sprite and under physics go compare velocity and then in the dropdown box there you can set to overall velocity, or whatever you may need.

Sorry I suck at explaning things :P

1am on a Saturday night my brain is...'elsewhere' xD
B
22
S
6
G
1
Posts: 30
Reputation: 1,379

Post » Sun Apr 30, 2017 12:02 pm

higher2003 wrote:and event, double click the sprite and under physics go compare velocity and then in the dropdown box there you can set to overall velocity, or whatever you may need.

Sorry I suck at explaning things :P

1am on a Saturday night my brain is...'elsewhere' xD

Great, thank you very much!
ImageImageImageImage
B
27
S
9
G
7
Posts: 229
Reputation: 5,493


Return to How do I....?

Who is online

Users browsing this forum: vegapomme27 and 10 guests