How to constrain an actor to platform movement?

Hi everybody,
As the title above, i wanna ask about how to constrain an actor to platform movement?

I have an actor that if i press a command button the actor being thrown to a platform that move left and right repeatedly, the problem is when it thrown and collide with the moving platform, the actor didn't follow the platform movement. Any idea how to fix it? to make the actor follow the platform movement.

Thx before :)

Comments

  • mrpacogpmrpacogp Member Posts: 400
    Yes, on my game i have solved that using density.
    What value of gravity do you use?
    Play modifying that and you got solved.
  • FViMaginationFViMagination Member Posts: 89
    you should first create a game Attribute called like "PlatformPosX", real attribute.
    then, you should put a Constrain Attribute behavior into your Platform Actor that constrains game.PlatformPosX to self.Position X
    then, you should create a Rule that says when Platform collides with Player, Constrain Player Position X to game.PlatformPosX. your Platform or Player Actor should have a Collide behavior too, you'll then choose the Bounciness value as preferred.
    all this will allow your Player to follow the x movement of the Platform, in the center of the Platform.
    hope this helps
  • williamt2706williamt2706 Member, PRO Posts: 85
    @mrpacogp
    really? I have tried to set the actor density to 2000 and for gravity i use acceleration downward on the actor 200 point. The actor still didn't follow the platform.

    @FViMagination
    I have tried that too before. But everytime player actor collide the platform, it's being warp into the center of the platform and follow the platform movement, because both the actor and platform (self.position x) is 0 value. But my platform has 125 pixel width, and the actor can land on any side of the platform. I want to makes the actor when land on any side of the platform, it's still stand on position (x) where the actor collide with the platform and follow the platform movement. Any idea?

    thx for the reply
  • mrpacogpmrpacogp Member Posts: 400
    edited December 2012
    Higher value of density on the platform, not the actor.
    My platform values:
    movable,fixed rotation, density 100, friction 3, bounciness 0
    main actor:
    movable, denstiy 1, friction 3

    My platform uses interpolate moving, but tested with move and work too
  • williamt2706williamt2706 Member, PRO Posts: 85
    I use all of your values setting, and it's still not working at all. I have no problem with up and down movement of the platform, only the left and right one. Am i missing something?

    Thx :)
  • williamt2706williamt2706 Member, PRO Posts: 85
    @mrpacogp
    I've figure it out just now and now it's working just fine. My stupid mistake, because for the platform movement i use constrain attribute to sin.(self.Time*100)*30+500. It's really move, but the fact it's only looks that it's moving, but it's not moving at all. that's why the actor stay still in that position. I change to move behaviour and the actor follow it just fine :)) . Try that constrain attribute above on your platform, you'll see the platform is moving, but your player actor won't follow it :)) .

    Thx
  • mrpacogpmrpacogp Member Posts: 400
    Lol. Glad to see finalley solved. You are great!
Sign In or Register to comment.