- Home /
Question by
Malik Ehtasham · Mar 01, 2013 at 03:42 PM ·
javascriptcharactercontrollercollisiondetectioncapsulecollider
Collision Detection
Hello Gys i am new to unity..I am working on a 3D fighting game.But i am stuck in collision detection.I have this scenero:
:-I have two player ..I have attached character controller as well as capsule object
having capsule collider, rigidbody with no gravity and istragger on..I have place these
capsule object on different place of the mesh..Like one i have place with this hand .THis capsule is a child object on hand bone so where ever the hand bone will move this capsule will follow himm.
Now i want when my character will make a punch to other character..Lets suppose it will hit on the head of other player..then other player head should shake a little bit and then comeback to its orignal position..just like other game have..
:- I can detect the collion but now how can i move the head of victim player and also stop the moving hand of the player who has hitted second player..
:- Till now i have added this code in OnTriggerFunction().
function OnTriggerEnter(other:Collider)
{
var player=GameObject.Find("first");
if(other.gameObject.name=="LeftHand")
{
var curTransform : Transform;
curTransform = lefthand.GetComponent(Transform);
var a=curTransform.position;
print(a);
// lefthand.transform.Translate(5,0,0);
}
}
any Help...
Comment
Your answer
Follow this Question
Related Questions
Collision Detection in Capsule Collider 0 Answers
if CharacterController hit a rigidbody 1 Answer
Collision between capsule collider 0 Answers
Change the gravity direction for CharacterController 1 Answer
A node in a childnode? 1 Answer