Jump to content

Small Entities Fall Through Terrain


Recommended Posts

When you throw a small entity (with rigidbody physics, above 0 mass, swept collision mode on or off, and a generated or convex hull physics shape) the entity will sometimes fall right through the ground (whether the ground is a imported model, terrain, or BSP box). The throwing script I use is a slightly modified version of the FPSplayer.lua script.

I made a video to help show the problem.

 

https://www.youtube.com/watch?v=NYBlJxsM04k

Check out my game Rogue Snowboarding- 

https://haydenmango.itch.io/roguesnowboarding

Link to comment
Share on other sites

In this example, you can see it's working in a pretty extreme situation.

http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/entity/entitysetsweptcollisionmode-r147

 

Try calling this in app.lua:

self.world:SetPhysicsDetail(mode)

 

Where "mode" is the following:

0: Exact (shouldn't really use this but try it for testing)

1: Default

2: two iterations

3: three iterations

4: four iterations

5: ...

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Yeah that is werid because that example is way more extreme than mine. What is even more weird is that entities still go through the ground in my example even with SetPhysicsDetail() set to exact(0)! blink.png

I even made a completely new map with SetPhysicsDetail(0) in the App start and then I made a script that turns on SweptCollisionMode and added it to a couple entities with varying masses(.5,1,and 3). The model the entities used was the small crate model from the tutorial maps. I also changed the throw force in the FPSPlayer.lua script to 2000*entity:GetMass().

 

So far I haven't seen an entity with a mass of 3 fall through the floor but entities with a mass of .5 or 1 almost always fall through the floor. --i take this back after making the throw force 2000*entity:GetMass() every single object I throw eventually falls through the ground no matter the mass.

Check out my game Rogue Snowboarding- 

https://haydenmango.itch.io/roguesnowboarding

Link to comment
Share on other sites

It might be that terrain is somewhat less accurate because it has no volume.

 

The best approach is to probably not throw objects quite as fast, and try to make them a bit bigger if possible. I know this will happen with all the physics libraries out there.

 

 

Link to comment
Share on other sites

This happens with all physics libraries. I have limited exposure to most of them (especially in the past few years), but Box2d, if I recall, casts a ray along the trajectory to see if it will collide with a surface (despite depth) at any point along the path, and step a collision response if there is indeed a very small object in its path, regardless of speed.

 

You could try to make your "floor" polygon deeper to alleviate it.

 

For what it's worth, this just happened to me with a baseball bat I modeled and was throwing around last night, but I didn't address it since I was just playing around. :)

Coding for Christ.

Link to comment
Share on other sites

Hmm I may have to scratch my game idea if this is the case.... most of the combat in my game was based around throwing objects at enemies. The log you see in the example video was going to be the slowest and probably one of the bigger thrown weapons. dry.png

 

Hmmm I just had an interesting thought though.... What if I scaled everything up a good amount so that the objects still look small but are actually pretty big??? hmmmmmm...

 

Thank you for the responses!

Check out my game Rogue Snowboarding- 

https://haydenmango.itch.io/roguesnowboarding

Link to comment
Share on other sites

I would just make your log a little bit bigger. A cylinder shape also might be more accurate, using the cylinder setting in the physics properties.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

may I suggest that you make it switch off 'normal' collisions when velocity is high, in favor for checking with raycasting, and doing a custom physics for it (you can make your own drag dynamics and stuff then), then when the velocity is low, switch back to normal physics

  • Upvote 1
Link to comment
Share on other sites

what's the problem with making the ground deeper? If you're using a simple plane, without raycasts, everything will eventually fall through it. Probably despite extreme speed or not. You'd be scanning for an intersection of no depth, lol. A slower computer this will happen almost all the time on.

Coding for Christ.

Link to comment
Share on other sites

I started having this issue before I even used a terrain. I had a giant BSP box for the ground and things still fell through. No matter how thick the box was entities would still fall through. It did happen less often then it does when I am using terrain but it still happens nonetheless.

Also I am using leadwerks terrain and I don't think there is a way to just thicken the terrain.

Check out my game Rogue Snowboarding- 

https://haydenmango.itch.io/roguesnowboarding

Link to comment
Share on other sites

Huh, that's strange. Sounds like a bug with the swept collision, then? Granted you aren't doing something strange in your own scripts that would override collision (like setting position yourself, in some fashion, post collision response). Also, that your physics shapes are indeed accurate.

Coding for Christ.

Link to comment
Share on other sites

this used to be a common thing in LE2 with certain convex shapes at certain angles or with really small items, but working with julio at the time with test programs he was able to resolve this issue... granted this was using newton version 2-something or other... unfortunately it looks like its resurfaced again...

example vid of after it was resolved in the earlier newton dll

  • Upvote 1

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

  • 2 months later...

I added some very small objects to my scene and they were falling through the scene if I so much as placed them a bit too high in the editor.

 

I tried self.world:SetPhysicsDetail(0) for the exact setting but that didn't help. I then tried out self.world:SetPhysicsDetail(20) and that did the trick.

 

So if anyone is still suffering from this issue, exact isn't the end all, be all.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...