generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Ball has no friction?

Previous Thread :: Next Thread 
ShadowNinjaCrafter is not online. ShadowNinjaCrafter
Joined: 08 Mar 2015
Total Posts: 163
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
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
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
ShadowNinjaCrafter is not online. ShadowNinjaCrafter
Joined: 08 Mar 2015
Total Posts: 163
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
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
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
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
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
ShadowNinjaCrafter is not online. ShadowNinjaCrafter
Joined: 08 Mar 2015
Total Posts: 163
05 Oct 2017 05:19 PM
Thank you, I once again never thought of doing this.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
05 Oct 2017 05:21 PM
No problem, let me know if you need anything else.


Report Abuse
ShadowNinjaCrafter is not online. ShadowNinjaCrafter
Joined: 08 Mar 2015
Total Posts: 163
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image