Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark Physics & Dark A.I. & Dark Dynamix / Rolling Ball -What am I doing wrong?

Author
Message
Cloggy
19
Years of Service
User Offline
Joined: 31st Oct 2004
Location: Rayleigh, Essex
Posted: 20th Nov 2006 01:11
Could somebody look at the following code and tell me what I am doing wrong.

When you press the spacebar a small force is applied to the sphere along the x axis. The problem is the ball just keeps rolling and slows down at a very slow rate.

I have tried using different materials but nothing seems to alter the friction between the sphere an the plain.



I'm stumped with something that should be very easy.

Help would be much appreciated.

Cheers,

Cloggy
Codger
21
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 20th Nov 2006 01:26
I had the same problem in my pool game I eventually added the following function



replace the i to 1 for your code
You need to declare stopping# as a global variable outside of the function.
It is a work around but I could not make a material that would slow down the pool balls in any reasonable manner

hope this helps

codger

System
PIV 2.8 MZ 512 Mem
FX 5600 256 mem
Cloggy
19
Years of Service
User Offline
Joined: 31st Oct 2004
Location: Rayleigh, Essex
Posted: 20th Nov 2006 09:08
Codger,

Thanks for the code, I tried something similar but wasn't particularly happy using it because it felt like I was bypassing the physics a little.

I wonder if anyone else has experienced problems like this with materials.

Cheers,

Cloggy
ESP
17
Years of Service
User Offline
Joined: 2nd Aug 2006
Location: London, England, U.K.
Posted: 20th Nov 2006 12:40
Hi Cloggy/All,

I've been playing with this, and put back the gravity at -98. Now what seems to happen, is the ball veers off at 90 degrees after about one second, and the Z component becomes -1.9 . Any ideas?

Robin
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 20th Nov 2006 17:21
Dynamic friction won't work because it relates to sliding. You aren't sliding, you're rolling. I think that is why angular damping is necessary.

In virtual physics, you're using surfaces that are smoother than glass. In the real world, friction would happen between the tiny blemishes in the surfaces, which you don't have.





Cloggy
19
Years of Service
User Offline
Joined: 31st Oct 2004
Location: Rayleigh, Essex
Posted: 20th Nov 2006 21:44
BatVink,

Thanks for that info. One other problem is that although the 2 commands



are used. the sphere continues to move even when the velocity drops below .1

Is this a bug, Or do I not understand what that command is supposed to do?

Cheers,

Cloggy
Codger
21
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 21st Nov 2006 02:18
My understanding of setting an object to "sleep" is that the physics engine ignores the object rather than it being stopped.

Also remember in the snippet that the stopping# variable needs to be global here is your origional code with the modified function added



System
PIV 2.8 MZ 512 Mem
FX 5600 256 mem

Login to post a reply

Server time is: 2024-04-27 00:24:09
Your offset time is: 2024-04-27 00:24:09