Applying Physics to Upwards Moving Platform

Get help using Construct 2

Post » Tue Nov 01, 2011 4:38 pm

Hi everyone,

Just started with Construct 2 yesterday and love it so far. I am trying to replicate some functionality in a game I started in another engine and I am somewhat puzzled by what I must be doing incorrectly. I have used the search, went through the stickies and re-read the physics tutorials; still no luck.

I have blocks falling from the top of the screen using the Physics and Bound to Layout behaviours (the later to prevent them from leaving the play area.

Moving upwards from the bottom of the screen, there is a platform that also has the Physics behaviour attached to it. To get the movement upwards, I am using an Event on every tick to set the Y-axis value to the current value - 2.

When I start the simulation, the blocks hit the platform, there are some minor bounces as expected based on the restitution values and then they stop while the platform moves through them. Once the platform moves through them the blocks fall off the bottom of the screen.

The Problem: As you can probably imagine, I need the blocks to sit on the platform and move upwards with it. Is it because I am manually setting the Y-axis value on the platform? Is there an option that could perhaps change the platform so it 'floats' upwards?

Thanks for your assistance!

B
22
S
5
G
6
Posts: 57
Reputation: 4,487

Post » Tue Nov 01, 2011 5:19 pm

Okay, I did a few more searches and found a great post that led me to the applying of upwards force on my platform at a value of 75 (against the default world gravity of 10), X=0, Y=0, image point=0.

So I now have a new problem in that the platform is moving upwards relatively quickly in an uncontrolled manner; the platform shifts from side to side. Quite hilarious but I need some control as I want to it to move straight up while still employing physics against the blocks.

Any ideas?
B
22
S
5
G
6
Posts: 57
Reputation: 4,487

Post » Tue Nov 01, 2011 5:30 pm

Okay, came up with an idea that seems to work a bit better than what I had but it still seems jerky.

Since I am building this for a mobile device, I made the platform the exact width of the screen and then constrained to to the layout. I still have the force being applied upwards as per a post that Ashley made last month (http://www.scirra.com/forum/somethings-id-like-to-see_topic44932.html) so my only real issue now is that the blocks seem like they are shaking. If I recall correctly that could be due to some tweaking of the Box2D values (friction or something) so I will take a look at that.

Wow! I love how you can work through a number of tweaks in such a short time frame.

B
22
S
5
G
6
Posts: 57
Reputation: 4,487

Post » Tue Nov 01, 2011 6:03 pm

Sigh. As I continue to work on this I am running into a second issue along with the shaking blocks. It seems that they all start to slide to the left side of the screen. Is that because the platform is not 100% level???
B
22
S
5
G
6
Posts: 57
Reputation: 4,487

Post » Thu Nov 03, 2011 2:21 pm

After some messing around I managed to fix this on my own by trial and error (sometimes the best way to learn a new tool). I was applying force but that gave me some really odd artifacts (read above) so I instead just applied upwards (negative Y) velocity against the platform and it seems to work much better. There is still a bit of shake in the blocks as they land on the platform but I think that should be relatively easy to tweak.
B
22
S
5
G
6
Posts: 57
Reputation: 4,487

Post » Thu Nov 03, 2011 5:30 pm

I have ran into another issue...

As more blocks fall onto the platform, they start to add more and more weight onto my platform to the point where the velocity I have applied against it to move it upwards, stalls and it comes crashing down to the bottom of the screen.

Does anyone know how I can keep it moving upwards regardless of how many blocks (adding additional weight) fall onto it?

Thanks!
B
22
S
5
G
6
Posts: 57
Reputation: 4,487

Post » Thu Nov 03, 2011 5:36 pm

Hi PixelAmp!

Can you provide a capx of the project? It would be a lot easier to assist you if we can see what is going on ourselves.

You can use DropBox if you need a file host.
Don't see the fnords and they won't eat you!
B
75
S
16
G
12
Posts: 322
Reputation: 11,608

Post » Thu Nov 03, 2011 9:38 pm

Thanks for the reply Wastrel!

I managed to get it working. For those that are interested, I totally made a boneheaded move... LOL!

Since the blocks were forcing the platform downwards, I neglected to check the density field for the platform. I increased it to 99 and that seems to have resolved it.
B
22
S
5
G
6
Posts: 57
Reputation: 4,487


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 30 guests