- Home /
Move player after colliding with trigger?
Hello, I'd like help with the code so that when you have your character controller (named and tagged "Player") collide with a trigger, the trigger will send the player to another location in the scene or to a specific empty game object in the scene. Any help would be appreciated. Thnkx
This has been answered before. Refer to Bunny83's answer for the most complete solution: http://answers.unity3d.com/questions/396746/two-way-teleport-.html
Ive looked at other threads having any similarity to what I am trying to accomplish, in vain. Bunny83 did get me close. but I am still having issues moving my player.
Answer by DeBunked · Feb 11, 2013 at 03:03 AM
function OnTriggerEnter(object : Collider){
if (object.GameObject.Tag == "Player")
{
object.transform.position = emptyObject.transform.position;
}
}
Something along these lines although this stuff isn't too hard to figure out yourself. I'd advice you to do that first so you have a basic understanding of how you can solve problems like these.
Your answer
Follow this Question
Related Questions
How to make player (sphere) shoot the ball (another sphere)? 2 Answers
rigidbody.velocity not working on x axis 2 Answers
When Colliding With Animation, Player Re-spawns And Keeps Moving. 1 Answer
Activate Object with trigger and if leave then inactivate 2 Answers
Make a object stop rotating on collid 0 Answers