- Home /
Object moving OnTriggerEnter, please help?!
Hello all,
I have a quick question on making a gameObject move when you enter a trigger zone. In my scene, I have a cube named "movingcube," and a FirstPersonController (Player.) I am trying to make it so whenever you walk into a trigger zone (a cube with the mesh renderer off, and the "Is Trigger" box ticked) it makes the "movingcube" move from Point A to Point B (One place to another.) If anyone could help me out with this problem, I would seriously appreciate it!! I've been trying to figure this out for a day or two, and I can't wait to figure out how to do it! Thanks, guys! I really appreciate it! (If you need more details, feel free to ask.)
Answer by VicM · Dec 20, 2012 at 03:28 AM
Hi!
Well, I think you will have add more details of which components you have attached to the objects. Some code will be useful too.
What you want to do should not be too difficult to achieve, so don´t worry, you will figure it out soon.
In the meantime checkout the following Walker Boys´ videos in where they work with collisions for a small game. That also could help you a lot. http://vimeo.com/19462708 Watch videos 5-12 to 5-14.
What details do you need to help me? I'm willing to tell you all that you need to know as long as we can figure this out! I've been trying forever! Haha, whatever you need, I'll tell you!
As I already said, your code would be very useful and your gameobjects inspector configuration.
Did the tutorial videos help?
Answer by anilgautam · Dec 20, 2012 at 05:18 AM
You can Try with this tutorial
1st of all Debug.log when its enter in the range. If its printed over screen work on next thing .
function OnTriggerEnter (myTrigger : Collider) { if(myTrigger.gameObject.name == "box"){ Debug.Log("Box went through!"); } }
Your answer
Follow this Question
Related Questions
Moving object with a trigger? 0 Answers
OnTriggerEnter Help? 2 Answers
Is there anyway to make an object impenetrable? 1 Answer
Destroy a specific object on trigger? 1 Answer
Navmesh agent problem 1 Answer