Ray-cast Car Sliding Friction

I’m making a ray cast vehicles but car slides,I looked all around the internet for more information but my vehicle would still slide, fling or disappear.

Im using a Vector Force (Set to World) on each wheel, this is a snippet of the code to put the force on an attachment.

    --Suspension
	local worldVelocity = chassis:GetVelocityAtPosition(wheelAtt.WorldPosition)
	
	local springDir:Vector3 = relativeUP
	local offset = displacement
	local velocty = springDir:Dot(worldVelocity)
	local spf = (offset*configs.SpringStrength*mass) - (velocty * configs.SpringDamper)
	local suspensionForce = springDir*spf
	
	--Slip
	
	-- need help here. (local slidingForce = ?)
	
	--Controls
	local thrust = relativeFOWARD*0
	
	local forceVector = (suspensionForce) + (thrust) -- + (slidingForce)
	
	force.Force = forceVector
	visulizeForce(wheelAtt.WorldPosition,force.Force, classOfWheel)

What the car currently looks like
Screenshot 2024-04-10 141545

This is the attachment which has a vector force. The fake wheel or the translucent wheel has an offset from the collision and is not reletive to the wheel attachment. The attachment below the top attachment is the ‘root’ attachment which send down the ray. the blue lines are a force visulizer.
Screenshot 2024-04-10 141614

In Conclusion

  • The car does not have a force to prevent it from sliding.

  • All the forces are summed up to create a total force

  • There is a ‘root attachment’ which sends a ray and theres a ‘force attachment’ which makes the car ‘stand up’ (using a VectorForce) and is offset to properly send the force.

  • The suspension or the floating force does not have any problems. (Create a diffrent vector force for each axis? - Suspension Up ; Sliding and Steering Right ; Throttle and Brake Foward/LookVector)*

1 Like

I found the solution, thank you for viewing my post and not trying to help that really helps me.

Yo you should slide the method please i am in need :pray::pray:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.