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. Dismiss Notice

Question Create, update, and "transform" bones at runtime?

Discussion in 'Scripting' started by capocchione, Oct 13, 2020.

  1. capocchione

    capocchione

    Joined:
    Dec 9, 2019
    Posts:
    47
    Is there a way to create and "transform" bones at runtime in Unity?

    Meaning, I've some scripts calculating and updating stuff each update, is it possible to place a series of bones in the positions I've calculated? For example, for each update, I have the start position and the end position. The end position changes each update (sort of growing). I want to put a bone from the start point to the endpoint. This way, the bone "grows" as the endpoint is updating its position. Then, I need to iterate this, making a lot of bones connected to each other.

    I can't find any documentation about this, I've found only pre-made skeletons to animate but what about to create it from scratch, at runtime via scripting?

    If was not clear, please just let me know, I'll try to explain better or trying to post some screenshot or drawing.

    Thank you for helping!
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,769
    This is where Is started when I was procedurally creating bones and meshes and rendering them with SkinnedMeshRenderers:

    https://docs.unity3d.com/ScriptReference/Mesh-bindposes.html

    Pretty simple to setup from that script. You're also welcome to peruse my MakeGeo repository for procedural geometry in general:

    MakeGeo is presently hosted at these locations:

    https://bitbucket.org/kurtdekker/makegeo

    https://github.com/kurtdekker/makegeo

    https://gitlab.com/kurtdekker/makegeo

    https://sourceforge.net/p/makegeo
     
    capocchione likes this.
  3. capocchione

    capocchione

    Joined:
    Dec 9, 2019
    Posts:
    47