Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Changing joint direction.

Discussion in 'Scripting' started by katsuragi545, Jun 20, 2016.

  1. katsuragi545

    katsuragi545

    Joined:
    Jun 25, 2014
    Posts:
    38
    I'm currently trying to create a swinging mechanic for a 3d platformer, but I can't figure out how to change the direction my rope swings. I'm using a chain of several hinge joints to create my rope. It can swing fine on one axis by default, but I would like to swing the rope forward and backward depending on which way the player is facing. Basically, the player can jump up and grab the rope - whichever way they are facing when they grab the roe would be forward, while the opposite would be backward.
     
  2. katsuragi545

    katsuragi545

    Joined:
    Jun 25, 2014
    Posts:
    38
    Okay, so it turns out with my setup (empty game object as parent with hinge joint chains as children connected to each other) can be rotated - just rotate the parent node. So rotating the parent's node to the desired rotation (player's Y rotation) should do the trick.
     
  3. katsuragi545

    katsuragi545

    Joined:
    Jun 25, 2014
    Posts:
    38
    Hmmm...seems like you can't do this during runtime though.