Physics iterations / Stop physics

Discussion and feedback on Construct 2

Post » Thu Feb 06, 2014 6:59 pm

Is settings Gravity to 0 and both iterations to 0 the same as disabling physics? I need to disable the physics of my game, but not the joints, how can I do it? I'm not getting my expected results
Please tag me with @caiorosisca if your post is refering to me :). I don't always follow the topics I answer.
B
11
S
4
G
1
Posts: 272
Reputation: 1,643

Post » Fri Feb 07, 2014 1:29 am

I don't think that setting the physics iterations to 0 will have the desired outcome.

There may be a better way to do this but I would put my physics objects into one family that has the physics behavior to keep things simple. I would also give the family 3 variables - let's call them X_vel, Y_vel and rot_vel.

Then, on the pseudo stop physics command I would do the following (aside from gravity = 0):

for Each Family:
     Family.X_vel = Family.Physics.VelocityX
     Family.Y_vel = Family.Physics.VelocityY
     Family.rot_vel = Family.Physics.AngularVelocity
     Family : set velocity = 0
     Family : set angular velocity = 0

I believe that things could still bump into each other if you move them while they're paused like this, but if the scene is static then this should work (works for a Pause function as well). Then, on resume physics (gravity = 10): for each Family set angular velocity to rot_vel and the x and y components of the linear velocity to X_vel and Y_vel. Colludium2014-02-07 01:32:15
A big fan of JavaScript.
B
74
S
20
G
71
Posts: 2,230
Reputation: 44,892

Post » Fri Feb 07, 2014 1:49 am

Here's a quick demo capx for you!
A big fan of JavaScript.
B
74
S
20
G
71
Posts: 2,230
Reputation: 44,892

Post » Fri Feb 07, 2014 12:33 pm

Thanks @Colludium, it worked, I also disabled collision between the family objects while paused so I can drag it without colliding with something.
Please tag me with @caiorosisca if your post is refering to me :). I don't always follow the topics I answer.
B
11
S
4
G
1
Posts: 272
Reputation: 1,643


Return to Construct 2 General

Who is online

Users browsing this forum: Google [Bot], Tombas and 14 guests