- Home /
Answer by Mike 3 · May 31, 2010 at 06:35 PM
function OnTriggerEnter(other : Collider)
{
other.transform.position = Vector3.zero; //set the colliding object's position to 0,0,0
other.transform.rotation = Quaternion.identity; //set the colliding object's rotation to 0,0,0
//alternatively, to change the trigger's position/rotation:
//transform.position = Vector3.zero; //set the collided object's position to 0,0,0
//transform.rotation = Quaternion.identity; //set the collided object's rotation to 0,0,0
}
If I use the transform.position & transform.rotation, how can I denote which object I am moving? (Sorry, totally ignorant >.<)
Answer by diabloroxx · Sep 07, 2010 at 06:50 PM
You need to edit the Position and Rotation property of the Gameobject Transform. http://unity3d.com/support/documentation/ScriptReference/Transform.html
To change the position use this - http://unity3d.com/support/documentation/ScriptReference/Transform-position.html
For rotation - http://unity3d.com/support/documentation/ScriptReference/Transform-rotation.html
Your answer
Follow this Question
Related Questions
How to make Canvas follow CameraRig [VR - HTC VIVE] 0 Answers
Freeze object's position and rotation 2 Answers
What's the best way to check if an area is empty? 7 Answers
Return object to position 3 Answers
Move object A towards object B 2 Answers