Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How would you simulate a crash with Body Velocity without flipping the part?

I created a vehicle which runs on a velocity object. Problem is, when I hit a wall, the rear fly's up and over the front of the vehicle trying to reach the given velocity. Is there any way to "Tame" this behavior? I've tried using bodygyro, but I would like it to adjust to ramps as well. Here's an example of what I'm trying to achieve, just take a car and ram it into the first wall you see. : http://www.roblox.com/Driftz-place?id=149996489

1 answer

Try making the car stop if it hits something that isn't named ramp. So, if you want your car to stop when it hits something don't name it ramp. For example:

velocitygiver = script.Parent.Parent.VELOCITYGIVERNAMEHERE --[Change this to whatever it is that has velocity in your car]--

function stopscript(part)
if part.Name ~= "Ramp" then --If its not a ramp then
velocitygiver.Velocity = Vector3.new(0,0,0) --Stop the car
script.Parent.Touched:connect(stopscript) 

This is made assuming the car is a model.

3 comments

0

Problem with the second part is when it's on a ramp and it hits a wall, it randomly straightens out.

0

And no, setting it in the middle makes no difference.

0

How about making an onTouched script that puts the cars velocity at 0 when it touches something thats' not a wedge. I'll change my answer to show what I mean.

This discussion is preserved as it was. New answers, comments, and votes are closed.