Keep Object From Moving on Y Axis

Hey everyone. Long time no see. I was wondering how I would keep a movable object from moving up or down when colliding with another object. It has to be able to move along the X axis but not the Y. Thanks everyone. :)

Best Answer

  • tatiangtatiang Posts: 11,949
    edited February 2014 Accepted Answer
    Try turning on fixed rotation and setting bounciness to zero on the "pipes" actor. Or try constraining self.position.y to a numerical value.

Answers

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Constrain attribute self.position.Y to self.position.Y
  • SolarPepperStudiosSolarPepperStudios Member Posts: 754
    edited February 2014
    @tatiang I tried that but it wouldn't work... :-/
    Edit: I might also mention that the objects I don't want to move up or down are moving along the X axis automatically. (Think of the pipes in Flappy Bird)
  • SolarPepperStudiosSolarPepperStudios Member Posts: 754
    Tried all of those suggestions except the last one. That last one will be tricky if they are spawned at a random height but I know its possible to do.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Tried all of those suggestions except the last one. That last one will be tricky if they are spawned at a random height but I know its possible to do.
    I'm not sure if it will help to do it but it's actually really simple. In your spawned actor, do change attribute self.startY (real) to self.position.Y. Make sure that behavior is at/near the top of the actor's rules. Then constrain attribute self.position.Y to self.startY.

Sign In or Register to comment.