OnCollisionEnter/OnControllerColliderHit/onTriggerEnter Won't work as teleporter?
Hey There! In my game, the player needs to bring objects to a teleporter, which sends them to some position so they will get organized as a pile (i organized them in way that when their position and rotation is set to 0,0,0 they are in that place). i tried OnControllerColliderHit method but it didn't seem to work, then onTriggerEnter and now i'm using OnCollisionEnter which doesn't work as well. i'm quite new to unity so i'm not sure if these methods are the same but i had to try.
here's my code:
Vector3 PilePos = new Vector3 (0, 0, 0);
Quaternion PileRot = new Quaternion(0,0,0,1);
void OnCollisionEnter(Collision Object1)
{
if (Object1.gameObject.tag == "Teleported") {
Object1.transform.position = PilePos;
Object1.transform.rotation = PileRot;
Object1.rigidbody.isKinematic = true;
}
}
all the three other functions were written pretty much the same, and all the objects are rigidbodies that of course has a convex collider, as well as the teleport (the script is attached to it). it seem to do nothing when the object touches the teleport. also i didn't quite understand when do i need to mark 'isTrigger'. overall, i feel like there's something basic that i'm missing perhaps? thanks.
Your answer
Follow this Question
Related Questions
ontriggerexit not working 1 Answer
OnTriggerEnter no longer works 1 Answer
ANIMATION TRIGGER DOESN'T PLAY 1 Answer
How do I check if the x position of my object is 0? 1 Answer
Trigger FinishLine 1 Answer