- Home /
Collision - 2 Objects
I've 2 characters, they both have characterControllers and Capsule collider(with same radius and height - to fit the characterController collider style), I want to check if there's a collision between them, and if there's so the second character will play an animation too.(which is attack animation)
On my main hero :
function OnControllerColliderHit(hit : ControllerColliderHit)
{
if(hit.collider.name.Contains("Lv"))
{
animation.CrossFade("attack1");
}
}
On the monster :
function OnCollisionEnter(hit : Collision)
{
if(hit.collider.tag == "Player")
{
animation.CrossFade("attack1");
}
}
$$anonymous$$ike, ins$$anonymous$$d of editing lol, answer me! :<
please provide more information. does it have an error. does unity call it or not? ...
Now, I put function OnControllerColliderHit(hit : ControllerColliderHit) and it does collide, but only when it moves.. I don't want it to collide just when it moves, I want a fast collision when there's a collision. which means - when the player hits the enemy when it's on move so they both will use animation.
There are almost identacle threads. Search before you post!!!
Answer by Ashkan_gc · Jun 24, 2010 at 02:10 PM
it seems that the problem is in another place like the name of the collider or the tag of the player. to make sure that the function is called use print and print the name of other collider and ... in less than a few month we will have a debugger wich will solve all problems like this easier. :) be aware that names are case sensitive.
Yeah I know, I'll put some debugs now, and what do u mean debuggers which will solve all problems? O_O
Your answer

Follow this Question
Related Questions
Stop animation when character controller hits walls 1 Answer
Stop Root Motion if out of boundaries? Simple Wall Climbing System 1 Answer
How to have other (any) Objects smoothly push a Character Controller? 1 Answer
Pixel Perfection collision on 3d animated object 0 Answers
Character Controller surpassing Collider with iTween 0 Answers