Search the Community

Showing results for tags 'Vector translation'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • RAGE Multiplayer
    • Announcements
    • Discussion
    • Suggestions
  • Scripting
    • Scripting
    • Resources
  • Community
    • Support
    • Servers
    • Media Gallery
  • Non-English
    • Русский - Russian
    • Français - French
    • Deutsch - German
    • Espanol - Spanish
    • Română - Romanian
    • Portuguesa - Portuguese
    • Polski - Polish

Categories

  • Scripts
  • Gamemodes
  • Libraries
  • Plugins
  • Maps
  • Tools

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


About Me


Facebook


Youtube


Skype


Web


VK

Found 1 result

  1. Hello all, I've spent some time working with the rotation property of the vehicle object (server side of course) and I've worked out why things are "broken" with it... The setter requires x, y, z angles relative to the vehicle where the x is roll, y is pitch and z is heading. The getter returns the x, y, z angles relative to the world. That is, if the vehicle is facing south (z = 180), the setter and getter values are equal, but at any other heading, the getter object cannot be used as the setter. To solve this, I came up with the following function - I thought it might be helpful to others... const relativeRotation = (rotation) => { const {x, y, z} = rotation; const rx = (360-z) / 180 * Math.PI; const ry = z / 180 * Math.PI; return { x: x * -Math.cos(rx) + y * Math.sin(rx), y: y * -Math.cos(ry) + x * Math.sin(ry), z }; }; Basic usage... // get the rotation of the vehicle relative to the vehicle. let {x, y, z} = relativeRotation(vehicle.rotation); x += 45; // adjust the pitch of the vehicle by 45 degrees // update the vehicle rotation. vehicle.rotation = new mp.Vector3(x, y, z);