zocken212 Posted October 21, 2014 Share Posted October 21, 2014 I've been thinking some time about this and didn't come up with a solution yet. Perhaps you can help me out? Well, I want a vehicle being stuck to the ground, in other words: Instead of flying after you hit a ramp it should stay on the ground. A bit unclear but I hope you will get what I mean. Regards Link to comment
Moderators IIYAMA Posted October 21, 2014 Moderators Share Posted October 21, 2014 Well you can change the vehicle handling: setVehicleHandling or push the vehicle down: setElementVelocity Link to comment
zocken212 Posted October 21, 2014 Author Share Posted October 21, 2014 First option: I already did this. I increased the mass (or was this wrong? dunno, am not such a handling expert) by a lot and it didn't really have any good effect (except the car being rammed continuously into the ground). Second option: I tried this as well and it also had not such a good effect for me. I'm setting the vehicles Z velocity to -0.005 every frame and it still floats around instead of sticking to the ground. Maybe I'm doing anything wrong? Link to comment
Moderators IIYAMA Posted October 21, 2014 Moderators Share Posted October 21, 2014 adjust the velocity depending of the distance from the ground. https://wiki.multitheftauto.com/wiki/ProcessLineOfSight https://wiki.multitheftauto.com/wiki/Ge ... enPoints3D Link to comment
zocken212 Posted October 21, 2014 Author Share Posted October 21, 2014 Thanks, I've come up to a solution with your given functions. Link to comment
GERgta Posted October 21, 2014 Share Posted October 21, 2014 First option: I already did this. I increased the mass Increasing the mass on vehicles does not really change how the vehicle interacts with the world. Atleast not like that. If you want additional info about what mass does, then open this spoiler: More mass = Makes the vehicle heavier, it does not affect the gravity of the car tho. It also causes a longer distance till the vehicle stops if you let go of W. Also causes less friction, if your car flip your car over (That's what causes that trucks slide across the ground, if on roof) or drive against a wall. Now back to topic: IIYAMA's way is the correct way of doing it. I would use a command: it should get the current ground clearance with getGroundPosition and getDistanceBetweenPoints3D. Then you use a timer (or onClientRender); If the vehicle is above the ground clearance that you calculated: push it down with setElementVelocity. EDIT: Ninja'd. Link to comment
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