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 prevent a ball-shaped object from rolling?

Let's say you were to throw an object in ROBLOX. After throwing, if it's sphere-like object, it will probably start rolling. What is the best way to prevent this?

I tried this myself, with successful results:

while wait(0.1) do
	if part.RotVelocity.magnitude > 0.2 then --part is the part we're trying to stop
		part.RotVelocity = Vector3.new(0,0,0)
	end
end

but as it's server-side script, obviously, don't you think it could be laggy? Well, it's all numbers we're checking and setting so probably not, and there's also a better way. That is, putting the condition of the if statement of the previous example inside the while, so when the RotVelocity is reset, it shouldn't roll again on it's own. Is there anyway a better way at all to detect the rolling and stop it or is this as good as it gets?

Thanks,

SwaggyDuckie

2 comments

0

You could just anchor it.

0

Then I would have to detect touch, and this wouldn't work in my case as I need the projectile to bounce off of walls.

1 answer

I discovered that using BodyGyro to disallow the rolling and using custom physics properties to make the projectile have more friction will stop the projectile allowing it to bounce off of walls. Although if you want an elastic ball, you should have less of friction, as if you have the maximum friction, it will start bouncing on the final landing spot.

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