linnik Posted July 15, 2018 Posted July 15, 2018 Hi, I save vehicle position and load it when server starts. Every time it's happening, vehicle rotation changes. Vehicle turns right after every loading. Parking: After restart: Any suggestions?
MrPancakers Posted July 15, 2018 Posted July 15, 2018 Are you loading the vehicles 'heading' position? xyz won't set the rotation. You can get the vehicle heading through player.vehicle.heading; and when you spawn the vehicle, there's a 'heading' property.
linnik Posted July 15, 2018 Author Posted July 15, 2018 (edited) 2 часа назад, MrPancakers сказал: Are you loading the vehicles 'heading' position? xyz won't set the rotation. You can get the vehicle heading through player.vehicle.heading; and when you spawn the vehicle, there's a 'heading' property. I use vehicle.rotation. Vehicle.heading has only getter, setter doesn't work. Edited July 15, 2018 by linnik
linnik Posted July 15, 2018 Author Posted July 15, 2018 OMG. Why is it still so inaccurate? Red line how I left it before saving, red how it spawns after restart. Цитата let Vehicle = mp.vehicles.new( Model, new mp.Vector3(parseFloat(Data["position"]["x"]),parseFloat(Data["position"]["y"]),parseFloat(Data["position"]["z"])), { heading: parseFloat(Data["position"]["h"]) } );
linnik Posted July 15, 2018 Author Posted July 15, 2018 (edited) Haha, this is ridiculous! In vehicle file I have 229.50584411621094 after spawning with this heading I've got vehicle.heading = 130.494140625 and vice versa when vehicle saved with the heading 130.494140625 it becomes 229.505859375 after restart. Edited July 15, 2018 by linnik
linnik Posted July 15, 2018 Author Posted July 15, 2018 How can it be if we have in wiki: Цитата heading: Number [-180:180]
linnik Posted July 15, 2018 Author Posted July 15, 2018 (edited) Not precise heading: Цитата Vehicle: 359.9999999999999(file) 359.9999694824219(vehicle.heading after setting) So I can say that vehicle.rotation works but both heading setter and vehicle.rotation round float in a some weird way. Edited July 15, 2018 by linnik
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