How do you make friction?

Non-platform specific questions.

How do you make friction?

Postby Freddy » Thu Aug 30, 2007 11:17 pm

How do you make something slow down when it is traveling? :)
Hola
User avatar
Freddy
 
Posts: 548
Joined: Sat Jun 02, 2007 3:42 pm
Location: Why do you want to know?
Score: 14 Give a positive score

Re: How do you make friction?

Postby d-soldier » Fri Aug 31, 2007 4:35 am

Friction? Do you mean inertia ?
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Re: How do you make friction?

Postby Fuzzy » Fri Aug 31, 2007 8:48 am

I'll give you a hint. Jumping/Gravity in GE is a friction.
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Re: How do you make friction?

Postby Freddy » Fri Aug 31, 2007 10:41 pm

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 :) .
Hola
User avatar
Freddy
 
Posts: 548
Joined: Sat Jun 02, 2007 3:42 pm
Location: Why do you want to know?
Score: 14 Give a positive score

Re: How do you make friction?

Postby Fuzzy » Sat Sep 01, 2007 4:26 am

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.
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Re: How do you make friction?

Postby Freddy » Sat Sep 01, 2007 4:04 pm

Ok :D, and how would I take a portion of the velocity of the ball?
Hola
User avatar
Freddy
 
Posts: 548
Joined: Sat Jun 02, 2007 3:42 pm
Location: Why do you want to know?
Score: 14 Give a positive score

Re: How do you make friction?

Postby pixelpoop » Sat Sep 01, 2007 7:47 pm

this would take 60% off of directional velocity.

directionalvelocity*=.4;
User avatar
pixelpoop
 
Posts: 276
Joined: Tue Aug 29, 2006 9:32 pm
Score: 28 Give a positive score

Re: How do you make friction?

Postby d-soldier » Sun Sep 02, 2007 4:33 am

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...
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Re: How do you make friction?

Postby pixelpoop » Sun Sep 02, 2007 8:18 am

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.
User avatar
pixelpoop
 
Posts: 276
Joined: Tue Aug 29, 2006 9:32 pm
Score: 28 Give a positive score

Re: How do you make friction?

Postby Freddy » Sun Sep 02, 2007 6:44 pm

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
Hola
User avatar
Freddy
 
Posts: 548
Joined: Sat Jun 02, 2007 3:42 pm
Location: Why do you want to know?
Score: 14 Give a positive score

Re: How do you make friction?

Postby DocRabbit » Thu Sep 13, 2007 3:08 pm

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
}
User avatar
DocRabbit
 
Posts: 114
Joined: Fri Oct 27, 2006 2:56 am
Score: 10 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron