- Home /
Collision with Plane fails
Guys I just encountered following issue.
I have a camera inside sphere, in fact center of the sphere and which acts as a first person view, wrote a script to move the sphere front, back, turn left and turn right using keyboard arrow keys. For moving forward and backwards, I am using transform.Translate with steps of 0.1f units.
Scenario : Glass Window from fbx (3DsMax) and applied mesh colliders in unity In this setup I got a fbx of a warehouse from a friend, and imported into unity. For the glass windows in the walls of the warehouse model, my friend used planes and transparent texture, and I applied mesh collider to those glass windows planes in unity.
Now when I am inside of the warehouse and while pressing the up arrow key, the sphere moves forward, and it just simply passes through the window, out of the warehouse and when I turn back and try to enter from the same window (through which I just came out) from outside of the warehouse, the collision occurs and it prevents me from entering.
I am bit confused why even after applying mesh collider, the collision is detected only on one side of the plane. Which means I can pass through let say side A to side B of the plane, but it detects collision while moving from side B to side A.
Please advice for what could be done so that the collision occurs on both the sides of the plane?
Regards,
Thank you Taxvi. Yes indeed I did test with that option as well, and it worked.
$$anonymous$$oreover I tried turning on the convex option for mesh colliders, but it gave me irregular polygon shapes which might not suit for every situation. $$anonymous$$ay this work for flat planes, but what about some 'L' shaped geometry, so convex may not be the solution everytime.
And consider a scenario where there are hundreds of such items, glass windows, thin sheets of different metal, thin wall in your scene. And applying box colliders to every one of those planes would surely become very cumbersome and may become tedious down the lane.
I am looking for a more generic approach which could save both artist and programmers time.
Regards,
hey, thanks for sharing. As much as I know colliders are ok, but using too many rigidbodies will kill the performance. but good for us unity shuts off motionless rigidbodies until they collide with something, so basically you can have tons of those as long as only limited amount of them are awake at all times. I'm rephrasing from Unity $$anonymous$$anual's Rigidbody Sleeping
You should always prefer box, sphere, and capsule colliders over mesh colliders if possible, they are much more efficient.
If you want to make something L shaped, it's better to use multiple box colliders than a mesh collider.