- #1
Nanako
- 39
- 0
Hello everyone ^^ I'm amateur programmer, making games for a hobby.
I'm trying to design a physical simulation engine here, and one thing I'm struggling with is modelling friction in code. I don't recall ever learning much about it in school, or perhaps i didn't pay enough attention, but regardless, I'm struggling somewhat to understand the concept.
My loose understanding of (dry) friction, is that it's created between moving objects, and acts to deplete their kinetic energy/momentum, gradually reducing velocity while they're in contact. As this is a game, it doesn't need to be 100% accurate, just "good enough". So i can afford to make plenty of assumptions such as uniform roughness, and not caring too much about how much surface area is in contact.
What I'm interested in is creating a simple model for dry kinetic friction. I want to be able to assign some arbitrary friction value to a game object, and calculate a coefficient from the two friction values of any relevant pair of objects. Presumably at the end up, i'd have some value to either subtract from, or multiply by, the two objects' velocities. (i'm not sure which, how proportional is this?)
my first thought with this problem was simply creating a multiplier value for each object (such as 0.3) and multiplying the other object's velocity by that value each second it's in contact with that object. I have a feeling that this is a bit TOO simple though, and I'm also worried about stopping. In conventional dry friction, objects generally DO come to a stop quite quickly, don't they? I'm thinking that just using a multiplier would result in the object getting perpetually slower and slower, but never fully coming to rest.
Is proper friction code going to bring objects fully to rest? or should i be using some cutoff velocity below which an object can be considered nonmoving, and set to 0?
If it helps any, I'm 23, i have mostly just a high school education, and some general familiarty with basic physics concepts. I'm a little bit more knowledgeable than the laywoman, but not too much.
Any advice, thoughts, and pointers in the right direction, are greatly appreciated ^_^
I'm trying to design a physical simulation engine here, and one thing I'm struggling with is modelling friction in code. I don't recall ever learning much about it in school, or perhaps i didn't pay enough attention, but regardless, I'm struggling somewhat to understand the concept.
My loose understanding of (dry) friction, is that it's created between moving objects, and acts to deplete their kinetic energy/momentum, gradually reducing velocity while they're in contact. As this is a game, it doesn't need to be 100% accurate, just "good enough". So i can afford to make plenty of assumptions such as uniform roughness, and not caring too much about how much surface area is in contact.
What I'm interested in is creating a simple model for dry kinetic friction. I want to be able to assign some arbitrary friction value to a game object, and calculate a coefficient from the two friction values of any relevant pair of objects. Presumably at the end up, i'd have some value to either subtract from, or multiply by, the two objects' velocities. (i'm not sure which, how proportional is this?)
my first thought with this problem was simply creating a multiplier value for each object (such as 0.3) and multiplying the other object's velocity by that value each second it's in contact with that object. I have a feeling that this is a bit TOO simple though, and I'm also worried about stopping. In conventional dry friction, objects generally DO come to a stop quite quickly, don't they? I'm thinking that just using a multiplier would result in the object getting perpetually slower and slower, but never fully coming to rest.
Is proper friction code going to bring objects fully to rest? or should i be using some cutoff velocity below which an object can be considered nonmoving, and set to 0?
If it helps any, I'm 23, i have mostly just a high school education, and some general familiarty with basic physics concepts. I'm a little bit more knowledgeable than the laywoman, but not too much.
Any advice, thoughts, and pointers in the right direction, are greatly appreciated ^_^