This is my gun script my gun is not following the camera on my character i wonder whats the problem here… can anyone please help me…
var cameraObject : GameObject;
@HideInInspector
var targetXRotation : float;
@HideInInspector
var targetYRotation : float;
@HideInInspector
var targetXRotationV : float;
@HideInInspector
var targetYRotationV : float;
var rotateSpeed : float= 0.3;
var holdHeight : float= -0.3;
var holdSide : float= 0.3;
function Update () {
transform.posotion = cameraObject.transform.position+(Quaternion.Euler(0,targetYRotation,0)*Vector3(holdSide,holdHeight,0));
targetXRotation=Mathf.SmoothDamp(targetXRotation,cameraObject.GetComponent(MouseLook).xRotation, targetXRotationV, rotateSpeed);
targetYRotation=Mathf.SmoothDamp(targetYRotation,cameraObject.GetComponent(MouseLook).yRotation, targetYRotationV, rotateSpeed);
transform.rotation=Quaternion.Euler(targetXRotation,targetYRotation,0);
}
the whole error message is:
NullReferenceException: Object reference not set to an instance of an object
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.GetProperty (System.Object target, System.String name)
UnityScript.Lang.UnityRuntimeServices.GetProperty (System.Object target, System.String name)
Gun.Update () (at Assets/MyScripts/Gun.js:16)