|
| 05 Oct 2017 05:09 PM |
| I'm making a golf game, but as the ball moves, it never slows down. I've tried altering the custom physical properties, but that doesn't work. Does anyone know how I can add friction to the ball? |
|
|
| Report Abuse |
|
|
|
| 05 Oct 2017 05:10 PM |
Balls don't have friction, that's all there is to it. On a perfectly flat surface and a perfectly round ball, even with the friction of sandpaper it will never stop rolling. That's not what friction is, my friend. Balls only stop rolling because the floor is never flat.
|
|
|
| Report Abuse |
|
|
|
| 05 Oct 2017 05:11 PM |
| i never thought of it that way, thank you. do you know of a way to create artificial friction then? |
|
|
| Report Abuse |
|
|
|
| 05 Oct 2017 05:13 PM |
And if you don't get what I mean or I wasn't clear, I will elaborate on the last statement. The floor has irregularities, the ball has irregularities. If the floor or ball is soft, it will squish down and it will require energy to rotate through the squish. (That's why flat tires don't work) Friction doesn't apply because the surface of the ball is not moving relatively to the floor.
|
|
|
| Report Abuse |
|
|
|
| 05 Oct 2017 05:17 PM |
You could perhaps add a script similar to this inside of it. I won't usually give scripts, but this is a fun challenge and your reply showed me that you care about learning.
while true do wait(1/15) -- I'm allergic to 1/30 (The minimum wait time) because it can sometimes bee too much. -- In this case it doesn't need to happen thirty times per second anyways. local y = Vector3.new(0, script.Parent.Velocity.Y, ) -- Get the Y velocity so the ball isn't slowed when falling. script.Parent.Velocity = (script.Parent.Velocity-y) -- Subtract Y *0.95 + y-- Keep 95% of the original speed. If the ball slows too much or not enough, change this number. -- Add y back to it so that it will stay falling. Now on the X and Z axes it will slow down gradually. end
|
|
|
| Report Abuse |
|
|
|
| 05 Oct 2017 05:19 PM |
| Thank you, I once again never thought of doing this. |
|
|
| Report Abuse |
|
|
|
| 05 Oct 2017 05:21 PM |
No problem, let me know if you need anything else.
|
|
|
| Report Abuse |
|
|
|
| 05 Oct 2017 05:32 PM |
| there was a problem when it completely stopped moving, it still kept moving in the other direction, so i added a if script.Parent.Velocity ~= Vector3.new(0,0,0) to fix that. but other than that, it worked perfectly and you saved me a lot of stress thinking about this. |
|
|
| Report Abuse |
|
|