Advertisement Jump to content
Sign in to follow this  
JS Lemming

Adding Friction to a point moving in 3D space.

This topic is 4913 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm sure this is super easy, but I'm not sure exactly what to do. I have a point that has and x, y, and z position and velocity. I need to slow down it's movement with friction, but I can't just lessen each velocity seprately becuase the velocitys aren't equall to each other (that would make one stop before the others... which looks wierd). It seems like I have to combine thier velocities into one or something crazy. Any ideas?

Share this post


Link to post
Share on other sites
Advertisement
The only problem with oliii's approach is that it's dependent on the time-step. It is applied based on the number of frames that have elapsed. Depending on what you're doing and how you're doing it, you may want it dependent on how much time has elapsed. You'd do that like this:
const DECAY = 0.8

x *= pow(DECAY, dt)
y *= pow(DECAY, dt)
z *= pow(DECAY, dt)
Where dt is the time per frame, and DECAY is what the speed is factored by every "second".

Share this post


Link to post
Share on other sites
Also, depending on what you're simulating the "friction" may vary as the velocity changes :) Atmospheric drag equations have a velocity-squared in there... Very little friction at low speeds, and lots when you go fast.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!