What is the best way to script a trigger that moves a object from point a to point b in C# (unity 5)
Hi! I am a beginner and looked over all the forums. I tried a lot of stuff too but it did not work out :( . I am building a maze right now. I only got the grid. So I want a trigger that let a wall fall down when a player walks true it. (from point A in the sky to point B on the ground in the maze). So I was wondering if somebody can explain and help me with this.
Please help me !!!
Answer by Fydar · Mar 08, 2016 at 06:18 PM
Create a new gameObject
Add Box collider
Adjust Box collider
Make the box collider a trigger by ticking "is Trigger"
Add script to gameObject
In that script, add:
public GameObject objectToMove; public Vector3 moveDirection; void OnTriggerEnter (Collider other) [ objectToMove.transform.position =+ moveDirection; }
Save and Compile!
Change the movement code as necessary. Hope this helps @R3dpyro
Fydar.
Your answer
Follow this Question
Related Questions
What is the best way to script a trigger that moves a object from point a to point b in C# (unity 5) 0 Answers
[Help] Player stops moving when hitting wall diagonally 0 Answers
Moving object between points 1 Answer
Hit a wall in my RTS movement controller. Issues with MoveToward and Coroutine logic. 0 Answers
performing animation on another player 0 Answers