- Home /
Question by
dkfister · Nov 04, 2012 at 03:08 PM ·
collisiontransformvector3contactsinversetransformpoint
Check collision on the sides
Hello, i tried to check whenever my player hits Right or Left, then it have to do something. But it doesn't seems to work. I use C# and here's the code. This is meant to be called from another class, just to make that clear.
void checkCollisionSide(Collision hit) {
Vector3 relativePosition = transform.InverseTransformPoint(hit.contacts);
if(relativePosition.x > 0) {
print("RIGHT");
} else {
print("LEFT");
}
}
Comment
Your answer
Follow this Question
Related Questions
move camera when it collides with a trigger 1 Answer
Collision.impulse.Set doesn't change the impulse's values 0 Answers
Transform.Position Collision Issue 0 Answers
Trouble setting up a vector 3. 1 Answer
Using collision with Vector3.MoveTowards 3 Answers