Saturday 9 April 2011

Update

After adding the other variables for Y and Z, I realised that this probably wasn't the best method as there should be a variable, which contains all 3 values.

function Update()
{
var playerx = 0 + gameObject.transform.position.x;
var playery = 0 + gameObject.transform.position.y;
var playerz = 0 + gameObject.transform.position.z;
print (playerx + ", " + playery + ", " + playerz);
}

first version

I then looked through the Unity Script Reference and found TransformPoint (http://unity3d.com/support/documentation/ScriptReference/Transform.TransformPoint.html)

function Update()
{
var playerPosition = transform.TransformPoint(Vector3.zero);
print (playerPosition);
}

new version

No comments:

Post a Comment