- Home /
Need Concave Collider to React with Gravity
I started developing a Lunar Lander game with an earlier version of Unity (4.6, I believe), but had to switch computers for development recently. However, upon installing the most recent version of Unity and recoding the physics for the player to work properly, I was confronted with a problem.
You see, some of the levels in my game have the asteroids/obstacles falling, with the player having to survive to win. When testing, however, I was confronted with a rather unfortunate truth: the player's ship would now phase completely through the asteroids with gravity enabled, which would no longer be detected by anything (Previously, they had simply passed through the terrain but reacted to my convex objects).
Unity informed me that it removed support for Non-convex MeshColliders interacting with Non-kinematic rigidbodies, so I attempted to fix this problem. However, I soon found that:
Gravity could not be enabled with kinematic objects (Which was necessary for the levels)
I could not change the asteroids to be convex, as they had more than the maximum amount of vertices (Sculpted in Blender)
The asteroids wouldn't react with any of my objects, convex or not (The player's ship and everything besides the terrain is convex)
I couldn't find a suitable solution on the internet
I would really rather avoid having to downgrade to a lower version of Unity to finish this game, as I feel that I'll need to get used to these new systems eventually. However, I'm completely lost as to what to do in order to get these levels working again, unless I need to code my own physics.
Any help would be greatly appreciated. Thanks in advance!
Answer by screenname_taken · May 20, 2015 at 07:37 AM
You could open up the asteroid mesh and make a new, highly simplified mesh that you'd use as a convex collider in Unity. Or, you could add multiple capsule collides on the main asteroid object that has the rigidbody component.
I would agree on this^ If the shape of the asteroid is really concave, then you can just create seperate convex meshes that fit together so they act aas a concave one as a whole. There is nothing keeping you from attaching multiple colliders to an object :)
I could not change the asteroids to be convex, as they had more than the maximum amount of vertices (Sculpted in Blender)
This tells me the asteroid mesh collider is probably WAY more complex than necessary. I'd recommend simplifying it in any case.
Indeed... A collision mesh with over ~65k vertices, for one asteroid? Jeez.
I should've mentioned that it would be preferable to still have the asteroids fall through the terrain. Some levels were designed to allow them to pass through it, and I haven't been able to limit their collisions in that way so far.
Is such a thing possible in Unity 5, or would it simply be easier for me to move back a version until the game's complete?
You could always change the asteroid's layer to one that still collides with the player ship but not with the planet.
Your answer
