Jump to content

Recommended Posts

Posted

 

This is the best I have been able to understand, but the character, when turning on the ground, jumps.

 

function this:AlignBoneToBody(bone, body)
       
        if bone and body then
            -- Obtener rotación del cuerpo en coordenadas globales
            local worldRot = body:GetRotation(true)
            -- Convertirla a coordenadas locales del jugador
            local localRot = TransformRotation(worldRot, nil, model)
            bone:SetRotation(localRot, true)
 
            -- Obtener posición del cuerpo en coordenadas globales
            local worldPos = body:GetPosition(true)
            -- Convertirla a coordenadas locales del jugador
            local localPos = TransformPoint(worldPos, nil, model)
            bone:SetPosition(localPos, true)
        end
    end

 

 

Astrocuco.thumb.png.c76e0fb3de2d6e437e7dca099625e11e.png

Murphy's Law: We don't fix bugs, we document them as features. – Murphy Games

Posted

In other words, I have to create the equivalent of TransformRotation but in Quaternions? I'm really blind in this because I don't understand very well. Do you have any code that can help me for that please.

 

 

Astrocuco.thumb.png.c76e0fb3de2d6e437e7dca099625e11e.png

Murphy's Law: We don't fix bugs, we document them as features. – Murphy Games

Posted

image.thumb.png.be5afea91c6176824aede0e36e1cb77e.png

 

I have better rotations, but the body is stretched: S

    function this:AlignBoneToBody(bone, body)
       
        if bone and body then
           
            -- Obtener posición del cuerpo en coordenadas globales
            local worldPos = body:GetPosition(true)
            -- Convertirla a coordenadas locales del jugador
            local localPos = TransformPoint(worldPos, nil, model)
            bone:SetPosition(localPos,true)
           
            -- Obtener rotación del cuerpo en coordenadas globales
            local worldRot = body:GetQuaternion(true)
            -- Convertirla a coordenadas locales del jugador
           local localRot = TransformRotation(worldRot, nil, model)
           
            bone:SetRotation(localRot:ToEuler())
 
        end
    end

 

 

Astrocuco.thumb.png.c76e0fb3de2d6e437e7dca099625e11e.png

Murphy's Law: We don't fix bugs, we document them as features. – Murphy Games

Posted

Of course I want to help. Just give me a few days to complete it. You don't need to use :toEuler() you can use quaternion to SetRotation().. Also I never used TransformPoint and TransformRotation. I made the whole ragdoll a child of a pivot and took the transforms locally and applied them to the skeleton locally.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...