Search Unity

gun spring physics

Discussion in 'Scripting' started by Mister-D, Jan 29, 2015.

  1. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    im wondering, whats the simplest way to apply some movement on an animated gun based on a animated characters chest movement?
     
  2. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    Do you mean the gun is carried by the character or mounted on his shoulder or something? The bones of the animation are accessible as Transforms while the game is running (you can see this by expanding the foldout for the character object in the hierarchy view during gameplay). From a script, you can parent the gun to whichever bone it is supposed to be attached to and it will then move with that bone as the animation plays.
     
  3. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    maybe i wasnt clear enough, ive added a screenshot that explains it a bit better, ;)
    i have two animated models, 1:a third person character,2: animated arms, i want to apply a spring like force to the animated arms based on the characters chest movement
    screen1.jpg