- Home /
Question by
BombEthan · Feb 28, 2015 at 05:20 PM ·
rotationjointspositioning
When creating joints during game play how do you change the position and rotation of an object.
See the picture below for what I am trying to do:
Here is the code that I am using that is in object 2:
function OnTriggerEnter(collision : Collider) {
if (collision.gameObject.tag == "Boundary")
{
return;
}
Debug.Log("Collided");
var joint : FixedJoint = gameObject.AddComponent(FixedJoint);
joint.connectedBody = collision.gameObject.rigidbody;
//transform.position This is where
//transform.rotation.Set I need help!!!!!
joint.breakForce = 5000;
joint.breakTorque = 5000;
}
So when they collide I need help with rotating and re-positioning object 2.
P.S. (The code is in Java Script and if someone has the C# version of this code that would be great.) Thanks for any help.
unity-question.png
(65.8 kB)
code.jpg
(36.7 kB)
Comment
Format your code by highlighting it and clicking the 101010 button. $$anonymous$$uch better than a screenshot ;)
Your answer
Follow this Question
Related Questions
Instantiate GameObject to specific position on the Parent 2 Answers
How do I rotate finger joints using controller input? 0 Answers
Tumbling a cube 1 Answer
Offset position to a target 3 Answers