Jump to content

Making the ground "stickier" causing vehicles to slow down when not colliding with the wheels


Recommended Posts

Posted (edited)

Hello!

I was browsing around mods and stuff for GTA SA and I found this video on youtube.

My question is how can I reach the same effect in MTA? What functions I need to make the vehicles flip more easily when touching the ground with the roof or something else but wheels. I already figured out how can I stop vehicles from sliding on the ground if they are on their roof or side, but I would like to know how can I reach this effect that can be seen in the video. Just check it and you will probably understand what I mean by "stickier" ground.

What functions will I need to use, or how can I make a similar effect on vehicle physics?

I downloaded the files so I can see if there is anything that helps me, but not too much, only a handling.cfg (which I don't think how they achieved this, or not ONLY by handling) and a .dat file, which I opened, but contained not enough information for me to help me out with this.

Thank you for your answers in advance!

 

 

P.S.: If anybody is interested in how I made the vehicles stop from sliding when flipped, here's the script:

function isVehicleOnRoof(vehicle)
	local rx,ry=getElementRotation(vehicle)
	if (rx>90 and rx<270) or (ry>90 and ry<270) then
			return true
	end
	return false
end

addEventHandler("onClientVehicleCollision", root,
function()
	local vehicle = getPedOccupiedVehicle(localPlayer)
	if vehicle and isElement(vehicle) then
		if isVehicleOnRoof(vehicle) then
			if getVehicleSpeed(vehicle) > 1 then
				local multiplier = 0.015
				local speedX, speedY, speedZ = getElementVelocity (vehicle)
				local loweredSpeedX, loweredSpeedY, loweredSpeedZ = speedX-(speedX*multiplier), speedY-(speedY*multiplier), speedZ-(speedZ*multiplier)
				setElementVelocity(vehicle, loweredSpeedX, loweredSpeedY, loweredSpeedZ)
			end
		end
	end
end)

 

EDIT: lol sorry for the long title

Edited by Dzsozi
Posted (edited)
1 minute ago, StormFighter said:

The resource that the video is about.

I don't know which resource it is in the Resources topic, could you link it? The video is about a mod for default GTA:SA.

Edited by Dzsozi
Posted (edited)
3 minutes ago, StormFighter said:

Oh... nevermind. Sorry, I just saw that you posted the vehicle realism system. I'm a bit tired. Sorry again.

Haha, no problem :D I would like to do something like this for that project.

Edited by Dzsozi
Posted (edited)

It is not caused by the handling, I just tested it on the admiral, copied the handling line from the downloaded handling.cfg for admiral and applied it in-game using handling editor, the same handling got applied like in the video, but when I flipped I kept sliding on the ground, so I think this has to do something with the surface.dat file, the handling is just for more realism I guess.

Edited by Dzsozi
Posted

You can also detect if the vehicle is in a rolling state and apply a little rotation to it with setVehicleTurnVelocity. Or you can do that based on speed, so if you spin at 200, you'll do plenty of barell rolls.

Posted

I will try that but I dont't know two things.

1. Is there any way to reset the vehicle turn velocity? Because I am changing that in other resource as well and I would have to reset that somehow.

2. How I could detect if the vehicle is in a "rolling state"?

Posted

If I were you, I'd make a script on client side, with what I'd check the vehicle's turn velocity on it's y axis on every frame, and if it's bigger than X then apply a little bit more to it.


The other thing. Turn velocity is basically spin. So resetting that means you set it to 0.

getVehicleTurnVelocity()
setVehicleTurnVelocity()

 

  • Like 1
Posted

It'd probably be possible to make your own surface properties by figuring out which values need to be added to remove all grip from said surface, then using proccessLineOfSight to get your current surface and add grip depending on so. However, it'd likely be very resource intensive and would need a server side refresher to accurately change your grip on the go.

Either that or make a suggestion allowing changing of surface data properties.

Posted
1 hour ago, Dzsozi said:

Achieved a very similar effect like in the video with the method @StormFighter said. Thank you for the help everyone!

Are you planning to release it to the community uncompiled? (Or can you send it via Skype?) This would be a nice addition to my race server if you allow me to use it. 

Posted
1 hour ago, koragg said:

Are you planning to release it to the community uncompiled? (Or can you send it via Skype?) This would be a nice addition to my race server if you allow me to use it. 

I don't know yet, I would like to finish it first, at least the big and harder part of it.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...