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.

Author
Message
Lord Einstein
20
Years of Service
User Offline
Joined: 22nd Oct 2005
Location: Well here, of course...
Posted: 23rd Oct 2010 13:39
I have been messing around with the ODE that's included in dark basic but it doesn't seem to work correctly. I have tried a few examples and objects seem perfectly happy going through one another, I don't know whether my DLL is working or whether its something I'm doing wrong.

Could someone please run this code and tell me whether the spheres start going through one another or not.

Rich Dersheimer
AGK Developer
17
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 23rd Oct 2010 18:52
It's a bit hard to tell, but it does seem as if the spheres are passing into one-another while they are squishing around the center.

Lord Einstein
20
Years of Service
User Offline
Joined: 22nd Oct 2005
Location: Well here, of course...
Posted: 23rd Oct 2010 19:23
Yea. They start off colliding off one another but as more arrive they eventually collapse and all pass through one another. Is this a short comming of ODE or maybe there is a command I need.
Neco
18
Years of Service
User Offline
Joined: 13th Jul 2008
Location: Waterloo, Wisconsin USA
Posted: 23rd Oct 2010 21:12
Its kind of hard for me to tell for sure.

Perhaps you need to break this down and slow it into execution steps you can manually trigger (like a Pause/Advanced X frames on a DVD player or VCR)

It almost feels like because there are so many, at different depths, it could be a visual illusion as they actually pass in front of or behind another sphere?

Lord Einstein
20
Years of Service
User Offline
Joined: 22nd Oct 2005
Location: Well here, of course...
Posted: 23rd Oct 2010 23:12
Unfortunately its not an optical illusion. The objects are passing through one another.

They are all attracted to a single point in the centre. They are expected to all fall towards that point and form a wobbling sphere of objects. They do form such a sphere for a moment, but then the engine gives up and they simply pass through one another resulting in them all oscillating through that point.

I tested it with less objects. It seems to work fine with 2 but 3 or higher it collapses. It does hold together for a little longer at 3 before collapsing though.

I was wondering whether this is a short coming of ODE or me.
BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 25th Oct 2010 10:27 Edited at: 25th Oct 2010 16:08
I thought I would help some here...
It has been a long time since I have played with ODE, but this should help.


Physics engines can have collision errors, but you can help constrain the errors within your simulation in ODE
by setting up some ODE world settings for the engine to use

Here is another version that moves the camera in & out using up and down arrow keys
Also a COOL feature, slowing down the ODE simulation using the left & right arrow keys.


I must confess, over time ODE errors get worse allowing objects to pass through each other, I don't know why.
Lord Einstein
20
Years of Service
User Offline
Joined: 22nd Oct 2005
Location: Well here, of course...
Posted: 25th Oct 2010 16:10
Kind of strange they seem to bounce away with more energy after a collision. Could playing around with the variables maybe solve that?

I had an attempt at creating my own physics engine with sparkey's collision thing. I think I have it working now. However, I now need to add rotational momentum.

BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 25th Oct 2010 16:17
I think bouncing with more energy is caused by raising the erp value unfortunately.
Also, setting the bounce and friction seem to have little effect, i don't know why

I generally use DarkPhysx instead of ODE, good luck with your Sparky's collision thing.
Lord Einstein
20
Years of Service
User Offline
Joined: 22nd Oct 2005
Location: Well here, of course...
Posted: 26th Oct 2010 13:21
Well its a little faster and better now but the main problem is that objects seem to gain a tiny amount of momentum when they collide at angles, as shown in this demo. Any ideas?

BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 26th Oct 2010 23:54 Edited at: 26th Oct 2010 23:56
Hmmm, well your math is over my head, but...

It looks like you might be using the distance they overlap/apart from each other as a calculation for their velocity after the collision
Sounds like the more they overlap, meaning a more direct collision the faster they should travel apart.

Seems like you should save each velocity and use that along with each elasticity to determine the velocity after collision and not the distance from each other.

If I'm not following your code (REM statements would be nice for so much math) then disregard my thoughts on this matter
Lord Einstein
20
Years of Service
User Offline
Joined: 22nd Oct 2005
Location: Well here, of course...
Posted: 27th Oct 2010 00:33 Edited at: 27th Oct 2010 00:34
Got a solution to the problem by adapting a tutorial for VB. It seems similar to my initial attempt but there is a change to a section that I'm not entirely sure about. But what the hell it seems to work pretty well. If you are interested here is the updated version. There is still a small problem with positions but apart from that it seems to work pretty well.



The problem is that I reposition the objects where they were before they moved during that iteration. This is not the best solution but it seems to work well enough for simple simulations and should be adequate for most games. I tried it with the sphere-cast to get a sliding position but this causes the spheres that are begin compressed on all sides (those at the centre) to jump out to the surface of the cluster.
BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 27th Oct 2010 09:24 Edited at: 27th Oct 2010 09:44
Your collision seems to work ok, but speed will be your biggest problem unless your simulation only has a limited number of objects to deal with, very good job though.

I also wrote your first version using DarkPhysics just to see it, kinda cool, but you can't compile it I'm guessing since it needs DarkPhysics.

It's a 5.6Meg .exe file. A nucleus forms in the middle from collisions. You can also explode the nucleus by pressing the space bar. You can also slow down the simulation with the arrow keys, and zoom in and out also.

If you want me to send it to you I can, just let me know. I don't know how to post a .exe file in the forum.
Lord Einstein
20
Years of Service
User Offline
Joined: 22nd Oct 2005
Location: Well here, of course...
Posted: 27th Oct 2010 10:14 Edited at: 27th Oct 2010 10:17
If you can that would be great.

Attach it to an email and send it to [email protected] please.

It seems to run quite fast, probably not as fast as dark physics though.

It runs 1000 objects at 11 FPS and I can get up to about 350-400 before there is any drop in FPS.
BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 27th Oct 2010 11:16
That is impressive speed!

Login to post a reply

Server time is: 2026-07-22 04:37:17
Your offset time is: 2026-07-22 04:37:17