- Home /
Default plane collider doesnt work properly when stretched?
In my game you have the ability to shoot projectiles (capsule), these projectiles are supposed to explode when they collide with an object, however when shooting towards the ceiling (Plane) the projectile sometimes doesn't explode.
Up on further inspection I noticed that a certain face (triangle within the plane) of the plane does not trigger the explosion (I'm using OnTriggerEnter and have tried OnTriggerStay without any difference) but other faces do I also tried making the ray ignore the plane but that resulted in the projectile simply moving through it.
so I decided to make a new plane to experiment with it. when the scale was x:z = 1:1 everything seemed to work fine but when i scaled it up to 100:100 around 30% of the projectiles didnt explode and 70% did.
has anybody got an idea why this happens and how to fix this? I could probably just use a Cube with a box collider, but I was just curious why this happens and if it is possible to fix it.
Just to be sure, how are you creating the plane and collider? When you scale it, are you talking about the transform scale, and do you see the green collider box increase in size to match?
This may not be the issue you think it is. Start by reducing fixedTimeStep to 0.01 from the default value of 0.02.
Edit > Project Settings > Time
If this solves your problem, take a look at the many posts about keeping objects from going through things.
While I don't think your problem is primarily the plane stretching, this script will allow you to make a plane of a specific size and as small as two triangles:
http://wiki.unity3d.com/index.php?title=CreatePlane
If you use this script, don't forget to add a mesh collider.
Oh and regardless of the plane you use, you can have a box collider on the plane if you want.
yes the plane has a collider, I'm able to stand on it (and as I said the Raycast function seems to work fine on it if there was no collider the Raycast wouldnt work right?), changing the fixed time step didn't change anything I'm using Vector3.$$anonymous$$oveTowards() to calculate where the projectile goes so it simply stops in the plane (and clipping through it so they should be triggering every single frame and even if I don't use move towards and simply make them move through the plane it ). If I pause the game and re-size the plane most of the projectiles go off immediately (even when paused) but some of them sometimes remain. It kind of must have something with the plane stretching i just did a test with the plane, a scale 1:1 plane and 30 shots gave 30 exploded a 1000:1000 plane 24 of 30 exploded surely that cant be coincidence (I also tried different shot angles but that didn't change anything).
thanks for the script though that could be useful later.
Your answer
Follow this Question
Related Questions
Can't click gameobject when over another trigger? 1 Answer
Trigger-based vehicle ai? 1 Answer
Trigger Spawning? 1 Answer
Temporarily ignore collisions between player and enemies 2 Answers
Adding Sound To Collectable Object 1 Answer