2D Toolkit Forum

2D Toolkit => Support => Topic started by: Neeko on May 31, 2014, 01:12:11 am

Title: Rigidbodies falling through tile map mesh colliders
Post by: Neeko on May 31, 2014, 01:12:11 am
I'm having an issue with rigidbodies easily falling through the mesh colliders of a tile map (not always, but usually). I've read http://2dtoolkit.com/forum/index.php?topic=3039.0 and the recommendation then was simply to use Physics2D, which I did do, but it actually made the problem worse.

I'm curious if there's anything else that can be done? I have the collision detection mode set to Continuous, which according to the Unity docs should detect collision for any static mesh geometry.
Title: Re: Rigidbodies falling through tile map mesh colliders
Post by: unikronsoftware on May 31, 2014, 07:07:32 pm
Continuous has never really worked as I expected. If its falling through, then perhaps you're moving the rigidbody too quickly? Or the scale is too small, etc. Try various settings (speed related) to see if you can improve it. Also, if you're moving it in code, make sure you're doing it in fixed update and using rigidbody.moveposition and not modifying position directly.
Title: Re: Rigidbodies falling through tile map mesh colliders
Post by: Neeko on May 31, 2014, 07:44:44 pm
Doubling the scale (1 to 2) did seem to fix the issue, but now the sprite is double the size which I don't want either.

The sprite is moving fairly slow and I'm not moving it via code so it does seems to be an issue with the scale. I guess I'll have to play around with it to find the optimal scale without having the sprite seem too big (if possible!).

As always, thanks!