I’m very close towards creating a script that aims and moves properly towards the center of the scene when I my character becomes “weaponReady”.
Yet I get this error:
MissingFieldException: UnityEngine.Transform.rotate
Boo.Lang.Runtime.DynamicDispatching.PropertyDispatcherFactory.FindExtension (IEnumerable`1 candidates)
Boo.Lang.Runtime.DynamicDispatching.PropertyDispatcherFactory.Create (SetOrGet gos)
Boo.Lang.Runtime.DynamicDispatching.PropertyDispatcherFactory.CreateSetter ()
Boo.Lang.Runtime.RuntimeServices.DoCreatePropSetDispatcher (System.Object target, System.Type type, System.String name, System.Object value)
Boo.Lang.Runtime.RuntimeServices.CreatePropSetDispatcher (System.Object target, System.String name, System.Object value)
Boo.Lang.Runtime.RuntimeServices+c__AnonStorey19.<>m__F ()
Boo.Lang.Runtime.DynamicDispatching.DispatcherCache.Get (Boo.Lang.Runtime.DynamicDispatching.DispatcherKey key, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.String cacheKeyName, System.Type[ ] cacheKeyTypes, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.Object[ ] args, System.String cacheKeyName, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.SetProperty (System.Object target, System.String name, System.Object value)
ArmControl.LateUpdate () (at Assets/Scripts/Control/ArmControl.js:20)
Current Script:
var lookTarget : Transform;
var cameraObject : GameObject;
var leftBone : GameObject;
var rightBone : GameObject;
var armControl : GameObject;
@HideInInspector
var currentX : float;
function Update ()
{
currentX = armControl.transform.rotation.x + cameraObject.GetComponent(MouseLook).currentXRotation;
}
function LateUpdate ()
{
if(GameObject.FindGameObjectWithTag("Player").GetComponent(PlayerMovement).weaponReady == true)
{
armControl.transform.LookAt(lookTarget);
leftBone.transform.rotate = Quaternion.Euler(currentX, 0, 0);
rightBone.transform.rotate = Quaternion.Euler(currentX, 0, 0);
}
}
Transform doesn’t have a rotate member, see:
Uh I don’t get it what I am suppose to add/change.
You want to rotate a transform, right? So use one of the rotation features that Transform offers you. Start by reading the documentation I linked you to, and, if any of that doesn’t make sense, post a more detailed question here. If you are completely clueless, then search for “rotation” on the documentation page.
Ok I know what I got wrong and I changed rotate to rotation:
var lookTarget : Transform;
var leftBone : GameObject;
var rightBone : GameObject;
var armControl : GameObject;
function LateUpdate ()
{
if(GameObject.FindGameObjectWithTag("Player").GetComponent(PlayerMovement).weaponReady == true)
{
armControl.transform.LookAt(lookTarget);
leftBone.transform.rotation = armControl.transform.rotation;
rightBone.transform.rotation = armControl.transform.rotation;
}
}
However I have a new issue:

I don’t understand why my right arm’s rotations are not matching up with the left arm.
I decided to use the spine instead for the rotation:
var spineBone : GameObject;
var mountObject : GameObject;
function LateUpdate ()
{
if(GameObject.FindGameObjectWithTag("Player").GetComponent(PlayerMovement).weaponReady == true)
{
spineBone.transform.rotation = Quaternion.Euler(mountObject.GetComponent(MouseLook).currentXRotation, mountObject.GetComponent(MouseLook).currentYRotation, 0);
}
}
Unfortunately, the y axis of the chest (spineBone) is rotating towards the direction of the mountObject where I just want that axis to rotate with it;
I decided I would instead use the first spine bone as the object to apply the rotations to. While my script will progress in the future to create a more realistic aim, I would like to share the script at its current state to give people on the forums some help if they’re trying to make an fps with a full bodied character (no floating hands in first person perspective).
var rootObject : GameObject;
var mountObject : GameObject;
@HideInInspector
var spineXPose : float;
@HideInInspector
var spineYPose : float;
function LateUpdate ()
{
if(GameObject.FindGameObjectWithTag("Player").GetComponent(PlayerMovement).weaponReady == true)
{
spineXPose = mountObject.GetComponent(MouseLook).currentXRotation;
spineYPose = mountObject.GetComponent(MouseLook).currentYRotation;
rootObject.transform.rotation = Quaternion.Euler(spineXPose, spineYPose, 0);
}
}