|
I have a script that creates a MeshCollider from the mesh I have, by removing any triangles which have an normal angle with World Up larger than a threshold. So far, this is working correctly, the problem comes in when I set my pieces of geometry to be static. After I do that, the generated MeshCollider is displaced by a certain amount, and my character, predictably, doesn't collide with the platform. Is there something I should calculate differently when dealing with static objects? There seems to be an offset that is being used for my geometry, which I have not set up. Any help will be appreciated, thanks! Red debug draw represents the generated MeshCollider
(comments are locked)
|
|
There's probably an issue with the actual meshes being changed when turned into static. Perhaps you can make them static after you have generated the colliders. http://docs.unity3d.com/Documentation/ScriptReference/StaticBatchingUtility.html What I'm guessing is that, when turning them geometry static, the instances store an offset from the one taken as the original instance. That offset must be wrong. I'll try to use Combine after all of them have their collision geometry generated.
Aug 04 '12 at 12:07 AM
ricardo.ch
(comments are locked)
|
The geometry has the static flag on.
The geometry has the static flag off.
can you post script that you use?
It's pretty much the same script mentioned here:
http://answers.unity3d.com/questions/236313/one-way-collider.html
I just added some debug drawing.
i did the following: - imported a model in unity - assigned a mesh collider to ir - attached a script from your link - marked object as static - tried to move and rotate object
collider does not displaced from rendering mesh
how can i reproduce the problem?
Create duplicates of the model with the script and collider and move them, then set them as static and run the game. Pause the game and click on the models to see where the collisions lie.
can you pack a simple scene with this problem to unitypackage?