I am currently building a game but in this game no collision is happening. i used Box collider,mesh collider also test it with regid body but nothing satisfy me.Nothing happened the player always passes through the object.Then i open a new project just to try collision but it gives me the same result.Please help me… here is my code for test.
function Update() {
print(“hellow”);
}
function OnTriggerEnter(other:Collider)
{
if(other.gameObject.tag==“C”)
{
Debug.Log (“collision”);
}
}
i move the player in scene .please help me solving this problem.i am facing this problem first time…
You appear to be trying to define the OnTriggerEnter function inside the Update function but it should actually be declared outside:-
function Update() {
...
}
function OnTriggerEnter(other: Collider) {
...
}
Also, if you have the Is Trigger property enabled for the collider then it won’t actually react to collisions but will just report them to the script. If you switch off Is Trigger then you should find that your collider will react properly to other rigidbody colliders in the scene.
i just copy and paste the code that’s its look like that,but my trigger function is actually outside of the update function.Still i can’t solve the problem.even i haven’t get any proper solution.
@rahat: How are you moving the player object? You need to use the Rigidbody functions (AddForce, etc) for the collisions to work correctly. If you are moving it by changing the position of the transform then the physics won’t work as you expect.
i tried all them.in the box collider i checked the is trigger for both object and also test on regidbody,mesh collider.i unchecked the is trigger in the regidbody.and also tried with checking it.But nothing worked.