Rotating and Translating JBEAM and DAE Coordinates

Discussion in 'Mods and Skins' started by HighBeam9000, May 7, 2022.

  1. HighBeam9000

    HighBeam9000
    Expand Collapse

    Joined:
    Aug 2, 2021
    Messages:
    265
    I recently built a mod (Ambulance Rescue Pack) where I used a preexisting resource (Crash Test Dummy). It was used with permission, so it's cool.

    The normal spawn position for the CTD is standing up. However, I needed it to be lying down on a gurney in the back of the ambulance. Slots have the "nodeOffset" and "nodeMove" directives, which translate the object going in that slot, but there doesn't seem to be a directive to rotate stuff.

    I wasn't sure exactly what 3D app I could use to perform the rotation, and I wasn't sure how long it would take me to figure it out, so I wrote my own code to rotate the JBEAM and DAE file coordinates around the origin.

    I've attached the code to this posting in a ZIP file. It's written in as vanilla C as I could muster. It's a console app with the following arguments:
    [1] X-axis rotation, in degrees
    [2] Y-axis rotation, in degrees
    [3] Z-axis rotation, in degrees
    [4] Rotation order: [xyz, xzy, yxz, yzx, zxy, zyx]
    [5] X translation, in meters I think
    [6] Y translation, in meters I think
    [7] Z translation, in meters I think
    [8] Name of JBEAM file to transform
    [9] Name of DAE file to transform

    Is this the most elegant & robust code in the world? Absolutely not, but it works. If you need to rotate all of the node coordinates in JBEAM and DAE files, feel free to use this, and modify it to suit your particular purpose.

    No warranties, expressed or implied... Use at your own risk... blah blah... etc. etc.
     

    Attached Files:

    • Like Like x 3
  2. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,056
    As far as I know (could be wrong) you are the first one to make something like this for Jbeam rotation, cool
     
  3. HighBeam9000

    HighBeam9000
    Expand Collapse

    Joined:
    Aug 2, 2021
    Messages:
    265
    Thank you. :D

    It wasn't the easiest code I've written, so I figured I'd try to help others avoid my pain by passing the code around. I'm sure I'm not the only person to face the rotation problem and not quite knowing what to do.
     
  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