Page 1 of 1

How do you make friction?

PostPosted: Thu Aug 30, 2007 11:17 pm
by Freddy
How do you make something slow down when it is traveling? :)

Re: How do you make friction?

PostPosted: Fri Aug 31, 2007 4:35 am
by d-soldier
Friction? Do you mean inertia ?

Re: How do you make friction?

PostPosted: Fri Aug 31, 2007 8:48 am
by Fuzzy
I'll give you a hint. Jumping/Gravity in GE is a friction.

Re: How do you make friction?

PostPosted: Fri Aug 31, 2007 10:41 pm
by Freddy
Friction, as in the resistance of a surface to motion, as of an object sliding or rolling over it. For example, sandpaper on sandpaper creates much resistance; friction :D . Fuzzy, I see what you mean about jumping, but Im making a soccer type game, so I need the ball to slow down after the physical response. But thanks anyway :) .

Re: How do you make friction?

PostPosted: Sat Sep 01, 2007 4:26 am
by Fuzzy
have a friction variable for the actor. normally its set small, as the grass causes some friction. upon collision, take a portion of the velocity off the ball and assign it to whatever it hit.

If the ball crosses over(collides) with a non grass area, perhaps cement, or if its currently in the air, then change the value in the actors friction variable.

Re: How do you make friction?

PostPosted: Sat Sep 01, 2007 4:04 pm
by Freddy
Ok :D, and how would I take a portion of the velocity of the ball?

Re: How do you make friction?

PostPosted: Sat Sep 01, 2007 7:47 pm
by pixelpoop
this would take 60% off of directional velocity.

directionalvelocity*=.4;

Re: How do you make friction?

PostPosted: Sun Sep 02, 2007 4:33 am
by d-soldier
in·er·tia /ɪnˈɜrʃə, ɪˈnɜr-/ Pronunciation Key - Show Spelled Pronunciation[in-ur-shuh, i-nur-]
–noun
2. Physics.
a. the property of matter by which it retains its state of rest or its velocity along a straight line so long as it is not acted upon by an external force.

sounds like inertia to me...

Re: How do you make friction?

PostPosted: Sun Sep 02, 2007 8:18 am
by pixelpoop
did you look up friction as well? they are different, although when one body acts upon another you always have to take both into account to have precise predictions.

Re: How do you make friction?

PostPosted: Sun Sep 02, 2007 6:44 pm
by Freddy
It does sound like enertia, but I dont want to create the property of matter that keeps it going or keeps it stopped, I want the resistance that slows it down to a stop. Then thats when I need enertia. Get it? :D

Re: How do you make friction?

PostPosted: Thu Sep 13, 2007 3:08 pm
by DocRabbit
See if this helps.

SuperGlue=directionalvelocity
VirtualPerpetualMachine=0

Your are looking for something in between these two to bleed off the directionalvelocity of the ball until reaching a zero velocity at which the ball comes to rest.

COF of ball on Grass=.05
COF of ball on Concrete=.01 'Ball would roll much easier on concrete and for a further distance.

Code: Select all
'Check velocity of ball so you don't evaluate it if it is at rest.
'Use this in ball collision with grass area.
if(directionalvelocity!=0)
{
directionalvelocity-=.05;
}


'Use this in ball collision with concrete area.
if(directionalvelocity!=0)
{
directionalvelocity-=.01
}


This hasn't been tested, and would probably work better if you set a variable to a value when ball was colliding with different surfaces, and use the above code to evaluate it along with check for 0 velocity. Then you could place the code in the draw actor event where it needs to be actually.

Define a variable ballinfriction
Set value of ballinfriction to 1 for grass, 2 for concrete in the collisionevent of grass and concrete.

DRAWACTOR event of ball:
Code: Select all
if(ballinfriction==1 && directionalvelocity!=0)
{
directionalvelocity-=.05;
}


'Use this in ball collision with concrete area.
else if(ballinfriction==2 && directionalvelocity!=0)
{
directionalvelocity-=.01
}