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
blink0k
AGK Developer
6
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 9th Dec 2019 00:07
So dropping a compound object from various heights will cause it to stick in the floor or fall straight through it
Press 2, 3, or 4 to drop the object from various heights

Attachments

Login to view attachments
blink0k
AGK Developer
6
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 12th Dec 2019 00:29
So this is the "Raycasting" physics demo. As soon as i add compound shapes it tunnels.
Click and drag to lift the boxes. It takes a few tries but eventually they go though the floor
If you try it with the original (Single shape) it doesn't happen.

Attachments

Login to view attachments
fubarpk
Moderator
15
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Adelaide
Posted: 12th Dec 2019 02:09
Perhaps it may be an idea to post on GitHub
hopefully theres a fix soon
fubarpk
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
blink0k
AGK Developer
6
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 12th Dec 2019 20:58
Github issue. If you want it fixed then give it a thumbs up please
Stab in the Dark software
Valued Member
17
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 14th Dec 2019 19:35
Tunneling can and will occur in all physics engines. It can be minimized by adjusting the physics world scale and gravity
so that it correctly matches the size of your objects. Also compound collision shapes MUST NOT intersect with each other
or they will tunnel.
The coffee is lovely dark and deep,and I have code to write before I sleep.
blink0k
AGK Developer
6
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 14th Dec 2019 23:26
Thank you Mr Stab. I really appreciate your input.

Quote: "It can be minimized by adjusting the physics world scale and gravity"

The only way it avoids tunneling is if the gravity/scale are set such that the object floats to the floor like a balloon. The object in question is more dense and should fall faster is there anyway i can simulate this without changing the gravity?

Quote: " Also compound collision shapes MUST NOT intersect with each other or they will tunnel."

I have separated out the shapes and it still tunnels (See attached).

Also is there anywhere that constraints like this are documented? Is there an underlying product here that might have documentation i could look at?

Thank you very much for your time and input.

Attachments

Login to view attachments
Santman
8
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 15th Dec 2019 17:20
Isn't tunneling due to the physics being threaded and the speed to high? I.e. if you drop it from a really high height then the distance it moves at each step exceeds the collision check - it can move from just above the floor to just below the floor within a single physics step. Kerbal showed this amazingly, when you spend the game up beyond (if I recall) 32 speed....it was ALWAYS only a matter of time before it freaked out and everything fell apart.

Can you perhaps do a manual recast to get the height of the ground, then use that to ensure the physics object doesnt go below this?
blink0k
AGK Developer
6
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 15th Dec 2019 19:09
Quote: "Isn't tunneling due to the physics being threaded and the speed to high? I.e. if you drop it from a really high height then the distance it moves at each step exceeds the collision check "

If you run the attached example you will see that when you press 4 it will release the object from a height of 400 (Not a very great height) and it tunnels.

Quote: "Can you perhaps do a manual recast to get the height of the ground, then use that to ensure the physics object doesn't go below this?"

It tunnels everywhere; Floor, walls, every surface. You would have to do raycasting for every possible collision and if you have to do that then what's the point of having 3D physics?
In any case that option seems to be my only solution at this point.
blink0k
AGK Developer
6
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 17th Dec 2019 23:28
Further testing.
If you download the project and run it you can see that when dropping the object from a height of 300 or 400, it will attain a maximum velocity of 600 in both cases.
Only in the case of dropping the object from a height of 300 will it tunnel, so it's hard to understand how velocity is the cause here

Attachments

Login to view attachments
blink0k
AGK Developer
6
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 18th Jan 2020 04:56
The vehicle demo tunnels as well. Note the front tires embedded in the terrain. On one occasion it also fell through the terrain entirely

Attachments

Login to view attachments
fubarpk
Moderator
15
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Adelaide
Posted: 18th Jan 2020 05:07 Edited at: 18th Jan 2020 07:27
you've gone further than anyone ive seen with your car physics
mind you I think santman was working on something once and I
would love to have a hold of the libraries that disputes prevented
us getting

I know you use normal physics objects but I wonder what would
happen if they was replaced with character controllers for each
wheel etc been meaning to try it myself just haven't got around
to it or should I say roundtoit

Apologies if ive missed someone elses achievements with car physics


Edit it has the same problem in AppGameKit classic2 as pressing the 3 key most the car is underground after drop
MerryChristmas Everyone
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
Virtual Nomad
14
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 18th Jan 2020 06:17
I haven't looked at the code here yet but is there any y-rotation going on when u drop it? I havent had any tunneling on 4x since its early days but i maintain "no steering" unless theres a minimal amount of x/z velocity. If its not moving and i apply angular velocity, it will drop thru the terrain.
Virtual Nomad
14
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 18th Jan 2020 08:21 Edited at: 18th Jan 2020 08:33
ok, i've looked at the code and my last comment is irrelevant (re: angular velocity).

i understand that you want "more gravity" but doubling it (Set3DPhysicsGravity(0, -20, 0)) combined with your deviation from the default scale seems to be the issue without "reining it in" somehow.

if i SetObject3DPhysicsDamping(e.car.id,0.7,0.5) before setting the car's mass, i get no tunneling. without it, i fall through @ 300 every time (& never at the other 2 heights).

@ 200, speed = 526 at impact.
@ 300 & 400 = 600.0 (odd that they are both identical. see below)

adding the above dampening while leaving your doubled gravity but returning the scale to default produces:

509, 565 & 600(-603) speeds from respective drop heights with no tunneling for me. so, results similar to what you're looking for?

if i set the linear dampening to 0.4, the tunneling comes right back but, now, only @ a height of 400 (@ 800+ speed)
0.5 seems fine: 606, 710-715, 775-786. aka, definitely not a balloon.
0.6 and i'm ok @ 200 & 400 but 300 and i'm falling thru every time (speed ~650)

some of that seems "bug" to me and doesn't offer much light but, maybe, a place to further explore?

i don't know the bigger project for you, but for this i'd return to default scale, run 1000 tests at a a dampening you're content with and find a sweet spot?

hope that helps, blink. and, trust me when i say that i feel your pain re: agk's current state of 3dphysics trying to figure this stuff out (i want to be fair. i just don't "get it" like i want to ).
PHeMoX
2
Years of Service
User Offline
Joined: 9th Jan 2018
Location:
Posted: 18th Jan 2020 18:23
Quote: "Tunneling can and will occur in all physics engines."


Hmm, I don't know about that. I do understand how it would take a bit of time to detect when any shapes are intersecting and the issue of speed making it harder to detect collisions with thin objects. But it is not often you see physics objects disappear into floors or walls in games I think. I'd say this is in part due to having a pretty solid prediction of what the object is going to do. I'm clueless on how much of a factor the physics engine used itself is though. But if there are people who have ideas on how to tweak the physics, I'm definitely all ears.

With my 3D platform game attempt from a while ago that has a third person character with physics controller, I did notice it takes basically just the right values for the physics to work best. Some obvious things I found out then was also how spawning physics objects inside of physics objects causes problems of shooting objects away. Kind of to be expected.
Stab in the Dark software
Valued Member
17
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 20th Jan 2020 13:53
Quote: "I
would love to have a hold of the libraries that disputes prevented
us getting"


FYI: AppGameKit uses the (Open Source) Bullet physics engine. If you look at the AppGameKit source code all
of the Bullet physics engine is there all you have to do is Wrap it for tier 1. As we all know
Open source API's are often buggy and never complete so when I wrapped it for tier 1 I fixed
bugs and added features to the original API to make it easier to use in AGK. I also added 2 other
open source APIs. The VHACD API for convex hull decomposition and a CSG API for fracture which I heavily
modified from the original. IF you look at the AppGameKit source code you should be able to follow my code to add
all the features you need.
The coffee is lovely dark and deep,and I have code to write before I sleep.
Rick Nasher
2
Years of Service
User Offline
Joined: 25th Jul 2017
Location: Amsterdam
Posted: 20th Jan 2020 17:42 Edited at: 20th Jan 2020 17:42
Ran the te drop test and It almost looks as if the calculations of the distance vs velocity/acceleration etc do not add up, causing it to incorrectly detect where the collision should occur depending on the distance travelled, but as this only happening in combined objects: could it be that 1 object that hits the terrain under a different angle, as is connected to another it drags this other object in a different angle slightly under the terrain and then in turn that one drags the other again etc, etc?

I am tempted to think the engine should be rock-solid as was also used by Boston Dynamics to simulate their famous balancing robots.

Login to post a reply

Server time is: 2020-02-20 09:33:25
Your offset time is: 2020-02-20 09:33:25