Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Can't update bones at runtime

Discussion in 'Animation' started by jeffreyjene, Dec 26, 2020.

  1. jeffreyjene

    jeffreyjene

    Joined:
    Jul 9, 2018
    Posts:
    14
    I want to be able to rotate my player's spine towards a target during runtime, but the bones seem "locked" in place playing the current animation. I can't even alter the spine in the inspector while the game is playing. Is there a way to rotate bones in a model during gameplay?
     
  2. jeffreyjene

    jeffreyjene

    Joined:
    Jul 9, 2018
    Posts:
    14
    Actually I want to edit this a bit. I wrapped the bone in a gameobject (which I had to do at runtime or it breaks the animation for the top half of the body), which allows me to rotate it during gameplay. Now I wish to point the bone at a target in the world, but I'm thinking I'm screwing up the world/local space as the object never actually points at the target using "lookAt", but rather somewhere through the floor, etc.. I need to somehow translate the bone's local arrangement to point at a position in world space (unless there is a better way to do what I'm trying to do, I'm all ears).
     
  3. 00christian00

    00christian00

    Joined:
    Jul 22, 2012
    Posts:
    1,033
    You can rotate bones in LateUpdate, you won't be able to edit them in the editor since the animator is the one locking them by updating them continuosly.
    To test them out in the editor you must disable the animator component.
    Look at doesn't modify the position, maybe what you are seeing is the up axis that may get changed if you don't specify it.
     
    Xriuk likes this.