How to make things stick to each other?

BranFlizGamesBranFlizGames Member Posts: 91
edited November -1 in Working with GS (Mac)
I am trying to make it where when you press the "L" key the trailer will be attached to the truck cab. I do i do this?

Comments

  • liamoliamo Member Posts: 191
    in the truck actor

    constrain attribute truck x (real) to self position x
    constrain attribute truck y (real) to self position y

    in the trailer actor

    when key l is down
    constrain attribute self position x to truck x
    constrain attribute self position y to truck y

    if you want the trailer to rotate with the truck:

    in the truck actor

    constrain attribute truck rotation (angle) to self rotation

    in the trailer actor

    constrain attribute self rotation to truck rotation

    Cheers
    Liamo

    p.s. This will make the trailer stick onto the truck completely, to make it off to the sides, in the constrain attribute expression editor say.
    self position x+your value.

    PSS. you might not need the constrains for the 'Y'
  • BranFlizGamesBranFlizGames Member Posts: 91
    It didnt make it stick to the truck..it just moved it over the truck
  • BranFlizGamesBranFlizGames Member Posts: 91
    That didnt work..can anyone else help?
  • lildragnlildragn Member Posts: 105
    Hiya BranFliz, take a look at the below vid. Might be what you need



    ~t
  • RedlerTechRedlerTech Member Posts: 1,583
    Hey BranFliz, liamo was correct in one way, but when doing this...
    constrain attribute self position x to truck x
    it should be
    constrain attribute self position x to truck x + (truck.size.height/2 + a little more if you need), which will refer to the end point of the truck.

    ____________________________________
    Follow Me On Twitter
    Like Me On Facebook
    Check Out My Site For Development Blogs
Sign In or Register to comment.