- Home /
on collision loading a new level
Hello All I have a short game with about 5 levels.
As the FPS Cam navigates along a path they collide with an invisible plane that has a javascript on it to load level on collision.
Sometimes it works and sometimes not,
(rather it works in Unity, but not all the tim in iOs. All levels are listed in the game settings, so that's not it)
I am running the 5 beta and the colliders must be convex.
Any Ideas? Thanks in Advance
Here's the javascript:
#pragma strict
var levelToLoad : String = "nextLevel";
function OnTriggerEnter(other : Collider) {
Application.LoadLevel(levelToLoad);
}
It's the weirdest thing!
The script is on a PLANE In Unity 5 beta Th eTRIGGER is set to Convex half the time it works and half the time not...
Grrrr
I have even tried box colliders too.
Haelp!
Answer by Bentoon · Jan 13, 2015 at 04:44 PM
In case anyone has this problem with Unity5
1) The Trigger checked needs to be Convex 2) "Constant Detections" help on the Rigidbody on the Camera/Player. 3) I also put a few planes back to back : if the player is going fast and zooms through the first
Thanks
~be
Answer by mattyman174 · Jan 13, 2015 at 08:34 AM
Make the Trigger bigger.
If its to small the collision check might not occur when the player actually collides with the trigger.
Thanks $$anonymous$$attyman, This wasn't it. It seems to be "Constant Detections" on the Rigidbody on the Camera/Player. I also put a few planes back to back if the player is going fast