Issue with tags

Hi, So in the following code I am getting the tags of the cube which I have assigned.When I have Cube2 selected it prints Cube2 but if I select "MyCube" which has a tag Cube1 but no matter what it still says untagged in the log.Also Is it possible to add multiple joints ?

var force = -10.00;
var range = 10.00;
var player1 : GameObject;
var player2 : GameObject;
var fixedJoint:HingeJoint;
var fixedJoint2:HingeJoint;
function Awake () {

   player1 = GameObject.Find("MyCube");   
   player2=GameObject.FindWithTag("Cube2");

}
function OnTriggerEnter (c:Collider) {
print(c.transform.tag);
if(c.transform.tag=="Cube1"){

print("hello");

       print(player1);
}

function OnTriggerExit(c :Collider)
{
if(c.transform.tag=="Cube1"){

 }

}

Are you picking up collisions with child GameObjects? Did you make sure those children are also tagged?

Actually upon closer inspection, what do you mean "When I have Cube2 selected"? Do you mean in the editor? If so that has no effect on your code and what OnTriggerEnter will pick up.

I just learnt that he script is on Cube1 so it will not print the cube1 tag but cube2 always as that's the object it is colliding with.Also the Untagged object was another object in the scene that has collider associated with it.Ontrigger will pick up any collider irrespective of my selection.

So now the issue if anyone could answer/help:I have connected 2 rigid bodies but want to treat them as on object when rotating.Is there a way to group the two as one once they have joined?

`var force = -10.00;
 var range = 10.00;
 var player1 : GameObject;
 var player2 : GameObject;
 var fixedJoint:FixedJoint;
 var fixedJoint2:FixedJoint;
 var fixedJoint3:FixedJoint;
 var fixedJoint4:FixedJoint;

function Awake () {

  player1 = GameObject.FindWithTag("Cube3");   
  player2=GameObject.FindWithTag("Cube2");

  }

 function OnTriggerEnter (c:Collider) {

   if(c.transform.tag=="Cube2"){

            fixedJoint=player1.AddComponent(FixedJoint);
            fixedJoint2=player1.AddComponent(FixedJoint);
            fixedJoint3=player1.AddComponent(FixedJoint);
            fixedJoint4=player1.AddComponent(FixedJoint);

            fixedJoint.anchor=Vector3 (0.5,-0.5,-0.5);
            fixedJoint.axis=Vector3(0,0,-1);

            fixedJoint2.anchor=Vector3 (0.5,0.5,-0.5);
            fixedJoint2.axis=Vector3(0,0,-1);

            fixedJoint3.anchor=Vector3(-0.5,0.5,-0.5);
            fixedJoint3.axis=Vector3(0,0,-1);

            fixedJoint4.anchor=Vector3(-0.5,-0.5,-0.5);
            fixedJoint4.axis=Vector3(0,0,-1);

            player1.rigidbody.AddForce(10,0,0);
            fixedJoint.connectedBody = player2.rigidbody;
            fixedJoint2.connectedBody = player2.rigidbody;
   fixedJoint3.connectedBody = player2.rigidbody;
   fixedJoint4.connectedBody = player2.rigidbody;

    }

  }

 function OnTriggerExit(c :Collider)
{

   if(c.transform.tag=="Cube2"){

}

}`

Issues:1.Why is there so much shakiness(when moving one object up down or side) when the two rigid bodies are connected by fixed joints on 4 corners.I have two cubes as rigid bodies and sphere colliders. 2.http://vimeo.com/7886895 they are using fixed joint to connect the rod to the sphere and loos like they are using only one fixed joint and the objects are connected fine.What am I doing wrong?

Hi,

I have made a rig that uses multiple joints, and it's working fine, The shakiness is removed by increasing the solver iteration count of the physics engine and adapting the time steps ( in the time settings). This is true for any rig that expose shakiness or woobliness.

http://www.fabrejean.net/projects/excavator

for forum entries: http://forum.unity3d.com/threads/66871-Excavator-simulation

Bye,

Jean