Rishat7c Posted July 10, 2021 Posted July 10, 2021 (edited) I mapped objects in CodeWalker and decided to implement server side loading RAGE.MP. But there is a problem that when creating an object via mp.objects.new (), for some reason, rotation does not work .. In XML, rotation consists of 4 values (Quaternion), but RAGE.MP accepts Vector3 Tell me how you can convert values? Found in npm packages three.js library But when I convert from quaternion, the object in the game does not rotate like in CodeWalker .. Gentlemen, developers, tell me how you can rotate the object correctly. Here's a sample code how I convert: var three = require("three"); var object = { "model":"Prop_Container_01d", "position": ["2382.63900000","-2260.29900000","134.54850000"], "rotation": ["0.00000000","0.00000000","0.00000000","1.00000000"], "dimension": 0 }; var quaternion = new three.Quaternion(parseFloat(object.rotation[0]), parseFloat(object.rotation[1]), parseFloat(object.rotation[2]), parseFloat(object.rotation[3])); var convertedRotation = new three.Euler().setFromQuaternion( quaternion ); mp.objects.new(mp.joaat(object.model), new mp.Vector3(parseFloat(object.position[0]), parseFloat(object.position[1]), parseFloat(object.position[2])), { rotation: new mp.Vector3(parseFloat(convertedRotation.x), parseFloat(convertedRotation.y), parseFloat(convertedRotation.z)), dimension: object.dimension }); Edited July 10, 2021 by Rishat7c fix dimension
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now