Suggestion: Physics angle of gravity

Discussion and feedback on Construct 2

Post » Sat Jul 20, 2013 2:29 am

Hi,

I would like to suggest adding a "Set angle of gravity" option to the Physics behaviour, just as the Platform behaviour has.

I know there is the workaround of setting Physics gravity to 0, then creating a tick event where a force is exerted in the direction of whatever angle you want on an object. This is pretty impractical to add to every single instance you have on screen, and I feel that a Physics angle of gravity function would be quite beneficial to the program and a lot more convenient for game creators.

-Rob
B
4
S
1
G
1
Posts: 7
Reputation: 814

Post » Sat Jul 20, 2013 5:31 am

"Set angle of gravity" does exist though

Unless you mean in general, in which case what you can do is create a family of all the objects you want gravity to be applied to, and then set the angle of gravity of that family.

Edit: ah I miss read you the first time. However what you could do is make a family then apply the platform behavior to everything and turn off player control.

Edit2: or not because you cant control platform behavior of families haha silly me

Edit3: oh hold on, so apparently you can apply behaviors to the families themselves.

So what you can try is put everything you want to change gravity of into a family. Apply the platform behavior with default controls turned off to that family. Then add an event that sets the angle of gravity of that family. Hopefully that works.Suikama2013-07-20 05:42:23
B
6
S
2
Posts: 15
Reputation: 1,123

Post » Sat Jul 20, 2013 9:53 am

@Suikama

Thats not true physics though.
B
48
S
16
G
9
Posts: 1,098
Reputation: 11,197

Post » Sat Jul 20, 2013 2:58 pm

@Suikama

That's not a bad suggestion with the families. I'm going to try and alter this idea a bit.
And you're right, the "Set angle of gravity" does exist for the PLATFORM behaviour, but I need it for the PHYSICS behaviour.
But thanks for your input, it's always appreciated.
B
4
S
1
G
1
Posts: 7
Reputation: 814

Post » Sat Jul 20, 2013 3:31 pm

Just set world gravity to 0
Put every object that is affected by gravity in a family with the physics behavior
And apply a constant force at the angle you desire

Cheers !
B
42
S
17
G
17
Posts: 2,247
Reputation: 17,461

Post » Sat Jul 20, 2013 3:50 pm

Constant force doesn't give realistic physics.

World Grav = 0
Gravity Var = 0.2
Apply force to family = Object.Mass*Gravity Var
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
80
S
12
G
7
Posts: 965
Reputation: 10,750

Post » Sat Jul 20, 2013 5:07 pm

[QUOTE=rhostudios] @Suikama

That's not a bad suggestion with the families. I'm going to try and alter this idea a bit.
And you're right, the "Set angle of gravity" does exist for the PLATFORM behaviour, but I need it for the PHYSICS behaviour.
But thanks for your input, it's always appreciated.[/QUOTE] You can use both physics and platform behaviors at the same time though. Just have platform apply to the family and physics apply to each object individually.
B
6
S
2
Posts: 15
Reputation: 1,123

Post » Sat Jul 20, 2013 5:48 pm

@Whiteclaws
Yes, the apply force thing does work, but as AnD4D pointed out, it doesn't yield a realistic result.

@AnD4D
I'm not quite sure how your method is from simply applying a force. Could you please explain it?

@Auikama
That works, but it unfortunately does not give the effect I'm looking for.rhostudios2013-07-20 17:53:22
B
4
S
1
G
1
Posts: 7
Reputation: 814

Post » Sat Jul 20, 2013 6:11 pm

Set world gravity to 0
Set a global variable called "Gravity" and set it to 0.2.

Give the object the physics behaviour.

Event - Every Tick
Action - Apply force at angle

Angle = whatever you want, let's say 270 for fun.
Force = physics.mass*Gravity(variable)
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
80
S
12
G
7
Posts: 965
Reputation: 10,750

Post » Sat Jul 20, 2013 6:21 pm

If you just use force and have multiple objects of all different sizes, the small objects will move faster. The mass*gravity expression ensures they all move the same speed, which is what happens in reality.
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
80
S
12
G
7
Posts: 965
Reputation: 10,750

Next

Return to Construct 2 General

Who is online

Users browsing this forum: Euduardo and 15 guests