- Home /
Question by
Joevis · Apr 09, 2012 at 12:16 AM ·
controllertargetlook
Changing Head Look Controller Target
Hi
I wanted to change the 'Head Look Controller' script so that my character points his gun at a given target.
Any idea's how I should go about doing this?
Thanks
Comment
Answer by garner · Apr 09, 2012 at 03:28 AM
you can create a function inside the lookat script and pass a new target into it from player input:
function ChangeTarget(newTarget : Transform){
oldTarget = newTarget;
}
I have tried this but I get error messages
Cannot convert 'UnityEngine.Transform' to 'System.Type'
Also the target it my script is a 'Vector3'
you can try newTarget.position to get the vector3
function ChangeTarget(newTarget : Transform){ oldTarget = newTarget.position; }