- Home /
Hit Detection On Android
Hey Im making a jumping game on android where youo have to jump over a moving box, so the box is a normal cube, and i added a script where when the player hits the box, another scene loads. the cube has a animation of it moving across the floor, but it doesnt work. When the animation is off it does work. Please Help.
Here is the script.
var level : String; function OnTriggerEnter( hit : Collider){ Application.LoadLevel("Lose"+level); }
and trigger on cube is on
Does the player or the cube have a Rigidbody attached? If neither have a Rigidbody attached, then OnTriggerEnter will not run. Also make sure that both Player and cube are in layers that can interact with each other, according to the Layer Collision $$anonymous$$atrix of the Physics $$anonymous$$anager (in Project Settings).