#How do I stop small RigidBodies from falling through the TileMap?

42 messages Β· Page 1 of 1 (latest)

raven snow
#

some of the bodies seem to prefer to attempt escape through the collision of the tilemap rather than behaving properly, especially in places where the two edges of a tile meet

i have tried a couple of things, including making the collisionshape hitbox for the bodies larger and creating a separate larger static body that spans the length of the floor to try to catch the shells but nothing seems to be working

any help or ideas would be much appreciated! though do bare with me as i am extraordinarily new to the engine

reef flax
#

there are a few things we could try πŸ‘ do you have "Continous CD" enabled for your RigidBody2D's? Might take a performance hit with that enabled but im curious if that helps at all or not.

#

oops i should have first asked, what version of Godot are you using and are you using RigidBody2D for your bullet casings?

orchid tiger
#

I think you have scaled them

#

Use a spear shape or rectangle shape

raven snow
#

ay ty both for the input! the collision shape is already a rectangle and isn't scaled, also its godot 4 and yes they are rigidbody2d

#

i just tried using continuous cd but it didn't seem to have any affect

orchid tiger
#

Try spear then they work better most of time

raven snow
reef flax
#

ill have to think a bit more about what might help πŸ€”

raven snow
#

ha godspeed

orchid tiger
raven snow
#

lmao that made it worse somehow

orchid tiger
#

So if they are not behave properly trying changing then and find which works best

#

Also do not forget to notify if you find solutions

raven snow
#

makes sense, ill play around with some collision shapes and see if i can get it working

reef flax
#

Phibs i got another property to try

#

One Way Collision Margin, apparently higher values will make the shape thicker and can work better for shapes entering at high velocity πŸ‘ let us know if that helps at all!

raven snow
#

ay i will! lemme test

#

collision margin on the bodies or the tilemap?

reef flax
#

the bodies sorry i should have specified

raven snow
#

all good and thank god since editing the tilemap margin made them much angrier

reef flax
raven snow
#

just a full collision box per tile

raven snow
#

nvm its in the collsionshape

reef flax
#

nice yup you found it πŸ‘

reef flax
# raven snow

nice okay yeah i think thats as good as we can do, I was hoping there might be a way to make the collision shape thicker but its maxed out if its a full collision box a square. this is always a tricky thing that comes up with fast moving objects, sometimes its hard to tell what exactly will solve it πŸ€”

raven snow
#

ye its tricky fs. sadly editing the margin didn't seem to have any affect

#

wish tilemaps had some unified collision options or something of the sort

reef flax
#

I've still got a few ideas up my sleeves!
what do we have for these options?

#

here is the official documentation info on this issue btw
"
Objects are passing through each other at high speedsΒΆ
This is known as tunneling. Enabling Continuous CD in the RigidBody properties can sometimes resolve this issue. If this does not help, there are other solutions you can try:

Make your static collision shapes thicker. For example, if you have a thin floor that the player can't get below in some way, you can make the collider thicker than the floor's visual representation.

Modify your fast-moving object's collision shape depending on its movement speed. The faster the object moves, the larger the collision shape should extend outside of the object to ensure it can collide with thin walls more reliably.

Increase Physics Ticks Per Second in the advanced Project Settings. While this has other benefits (such as more stable simulation and reduced input lag), this increases CPU utilization and may not be viable for mobile/web platforms. Multipliers of the default value of 60 (such as 120, 180 or 240) should be preferred for a smooth appearance on most displays.
"

raven snow
#

same tickrate as you've shown, srry i was downstairs trying to find something to eat

reef flax
raven snow
#

increasing tickrate does seem to reduce it but not entirely

#

actually 240 seems to have fixed it! ty

#

any way i can measure performance in the godot test window? want to make sure that tickrate wont cause some cpus to explode

reef flax
#

yes that is certainly a concern! i'm not as expereinced with the whole benchmarking performance aspect but let me see if I can point you to some helpful resources, one moment πŸ‘