Results 1 to 3 of 3

Thread: Attach joints to other joints programmatically

  1. #1

    Attach joints to other joints programmatically


    i'm experimenting some coding with Delphi and GLScene. So far i managed to load an SMD model and various animations: I don't have a particular project in mind, but i'm amazed by the simplicity and power of this framework. The next step i'm trying to accomplish is to load a weapon and attach it to my character's hand at runtime.
    Both the character's hand and the sword have a joint, but i don't know how to get them together.

    I already tried to use something like WeaponActor.Matrix := CharActor.Skeleton.BoneByName('Weapon_R_Bone').Glo balMatrix but that's not what i'm looking for.

    The hilt of the sword, which contains the bone "Sword_Hilt", should be in the character's hand "Weapon_R_Bone".

    I searched inside the source code of the libraries for something like "AttachToBone" to no avail

    Does anyone know how to attach joints programmatically in GLScene?
    Sorry if my english sounds weird: it's not my primary language

  2. #2
    An update for the post above, i managed to correctly handle the sword's movement by commenting the "Syncronize" part and calculating the Matrix of the weapon's actor in the OnProgress event of the Cadencer

    Procedure TFormProgramma.AggiornaPosizioneArma(Sender: TObject; const deltaTime, newTime: Double);
    MatriceArma: TMatrix4f;
    //if i simply use something like
    //Arma.Matrix := Actor.Skeleton.BoneByName('Weapon_R_Bone').GlobalM atrix;
    //the sword's hilt assumes the right rotation, but wrong position as it floats just
    //above the hand's bone, so i look for another bone as a reference for the right
    //coordinates: the Bip01_R_Finger0Nub seems to be the right choice
    MatriceArma[0] := Actor.Skeleton.BoneByName('Weapon_R_Bone').GlobalM atrix[0];
    MatriceArma[1] := Actor.Skeleton.BoneByName('Weapon_R_Bone').GlobalM atrix[1];
    MatriceArma[2] := Actor.Skeleton.BoneByName('Weapon_R_Bone').GlobalM atrix[2];
    MatriceArma[3] := Actor.Skeleton.BoneByName('Bip01_R_Finger0Nub').Gl obalMatrix[3];
    Arma.Matrix := MatriceArma;
    Sorry if my english sounds weird: it's not my primary language

  3. #3
    Looking good! Glad you worked it out...


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts