Physics objects and Sine collisions?

Get help using Construct 2

Post » Wed Nov 21, 2012 12:13 am

Hey all,

I'm having a bit of trouble getting some physics collisions working properly so thought I'd see if anyone here had any pointers.

What I'm trying to do is have several square physics objects collide with a horizontal platform with the Sine movement behavior, and then have them rest on top and move along with the platform.

The problem being, when the square objects hit the moving platform they just stop in mid air and do not move with the platform, then continue to fall when they are no longer touching. Acting as more of a blocker, and not a moving piece of ground.

I can get around this with the pin function, but that just makes matters worse when two blocks land on top of each other, one being pinned and the other repeating the mid air stop action.

Am I missing something super obvious here? I feel like I am.

Thanks for any and all help.
B
6
S
2
G
1
Posts: 10
Reputation: 905

Post » Wed Nov 21, 2012 4:42 am

Mixing physics behaviour with other movement behaviours never really works properly.

Your best bet is to make your own sin movement using the physics behaviour...

I made a quick cap file, it's relatively simple as it only moves left and right but you could expand on it to make it go up/down and spin etc.

When you preview it, left click to create physics boxes.

capx file
B
28
S
8
G
1
Posts: 469
Reputation: 4,683

Post » Sat Nov 24, 2012 4:54 pm

That's exactly what I wanted, thanks a bunch.

Although looking at the code, I'm not quite sure how it all works. Do you know of any reading that will outline the basics of this type of stuff?

I'd love to learn how to do it myself, so I can just fiddle around with it to change the axes etc.
B
6
S
2
G
1
Posts: 10
Reputation: 905

Post » Sat Jun 15, 2013 11:01 pm

wow! @keepee, excellent example, but I have not clear of all.
Could you tell me how to works this part exactly of your example?

S_TarX==self.S_initX + sin(time*self.S_Spd)*self.S_Magn
B
14
S
4
G
2
Posts: 109
Reputation: 2,679

Post » Mon Jun 17, 2013 2:28 pm

I wrote a topic about this kind of movement (a request not a solution).
I forgot that sine Behavior will not work well with physic objects so i'm in a double trouble with this kind of stuff.

You solved part of my problem with your custom "sine behavior" (and sorry to steal the post). I also ask some insight of the code, mostly what all those variables do so i don't program in the dark something similar.

B
31
S
4
G
4
Posts: 110
Reputation: 4,588


Return to How do I....?

Who is online

Users browsing this forum: Zebbi and 20 guests