Physics and Portals

Get help using Construct 2

Post » Wed Apr 04, 2012 10:28 pm

Hey guys

So I have started using the physics in Construct and everything has been super easy to use. I'm having a slight issue when sending a rolling object through a portal type system like the one that is set up in the CAPX included

When sent through the orange portal on the bottom it exits on the ledge and loses quite a bit of momentum. The weird thing is if the ball is sent through the blue portal on the ledge it exits through the orange portal with increased momentum but in the opposite direction

Game File

Thank you for taking a look and any help is greatly appreciated.
Posts: 16
Reputation: 609

Post » Wed Apr 04, 2012 10:49 pm

you make a physical object cross hundreds of pixels in one tick. I still wonder why it's not even worth than just that.

I would probably save velocity and torque in variable on collision and reapply them after transfert (with maybe some some orientation changes if your portals have differents angles)
Posts: 1,479
Reputation: 16,336

Post » Thu Apr 05, 2012 1:25 am

Thanks for the help. I ended up not saving it as a global variable only because I couldn't figure out a way to get the properties of the ball to save to a global variable.

Instead I added an instance variable to the ball called Pushed to prevent the bullet from hitting the ball more than once and moving to fast.

Once the ball comes in contact with one square it is destroyed and the opposite square will respawn a new ball and reapply the torque/velocity. This is the reason that I added instance variable, and limit the speed, because the spawning torque/velocity are set by hand and I wanted the speed of the ball going in the portal to match the speed coming out, or at least look close.

Thanks again for the help and here is the updated CAPX incase anyone is interested!

Updated Game File
Posts: 16
Reputation: 609

Return to How do I....?

Who is online

Users browsing this forum: RoboFrosty and 26 guests