How translate world editor rotation Euler

Discussion in 'Utilities and programming' started by Riccarr, Nov 5, 2024.

  1. Riccarr

    Riccarr
    Expand Collapse

    Joined:
    Jul 28, 2024
    Messages:
    41
    I’m trying to use the world editor to determine rotation values for TSSTATIC objects I want to create in my mods lua code.

    World editor only shows the rotationEuler value (x,y,z). In lua code the .setField(‘rotation’ …) wants a quat.

    I’ve found that rotation object has a setFromEuler() but using it does not produce the same rotation in game as what’s shown in World editor.

    i know there is quatFromEuler() but again results do not produce same rotation of objects as shown in editor.

    what’s up?
     
  2. Riccarr

    Riccarr
    Expand Collapse

    Joined:
    Jul 28, 2024
    Messages:
    41
    To answer the question I know everyone is also wondering ... how to use World Editor rotationEuler(x,y,z) coordinates in obj.setField() ... how's the easy skinny ...

    Code:
    if rotation then
            -- rotation (vec3) x,y,z values from World Editor.
            -- convert to radians
            local radianVec3 = vec3(math.rad(rotation.x), math.rad(rotation.y), math.rad(rotation.z))
            marker:setField('rotationEuler', 0, radianVec3.x .. ' ' .. radianVec3.y .. ' ' .. radianVec3.z)
    end
     
    • Like Like x 2
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice