Physics objects and Sine collisions?

0 favourites
  • 5 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • 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.

  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)