Constrain 1 actor to another

micksolomicksolo Member Posts: 264
edited November -1 in Working with GS (Mac)
Hi,

I have 2 actors, man and collision.

man is just a guy running, and collision is separate because I only want collision on his head and not his whole body.

I have constrained attributes so collision sticks to the man, I set collisionPosY = ManPosY+40.

Problem is, when he runs on a flat ground, the collision sticks to him fine, but when he falls over the collision stays at Y+40. I tried setting a rule so that if ManPosYRotation >0, CollisionPosY=0 but that doesn't seem to work. Any help would be great!

Thanks

Mick

Comments

  • GLGAMESGLGAMES SingaporeMember Posts: 988
    You need to constraint both X and Y if i'm not wrong.
    If actor fall means it's moving in X axis? so shouldn't you have a contraint for that too?
  • ozboybrianozboybrian PRO Posts: 2,102
    You will either have to set up to Actors for the man.
    Actor > Body
    Actor > Head
    Constrain head to the X and Y of the top of the body.

    OR when collision overlaps or collides > Constrain to Y of Actor.

    Second one is probably better. since it's only gonna use one actor.
    .
    .
    .
    -----------------------------------------------------
    Join the GameSalad Community and have your game noticed for free.
    http://www.facebook.com/ListYourTopiPhoneGame
    List your Top iPhone Game on FaceBook!
  • micksolomicksolo Member Posts: 264
    ozboybrian said:
    You will either have to set up to Actors for the man.
    Actor > Body
    Actor > Head
    Constrain head to the X and Y of the top of the body.

    OR when collision overlaps or collides > Constrain to Y of Actor.

    Second one is probably better. since it's only gonna use one actor.

    The first way you mentioned is how I implemented it. Problem is, when the actor Man rotates, the arms still appear at y+40, so when he's lying on the ground (which is common in my game!), his arms are floating parallel 40 pixels above.
Sign In or Register to comment.