- Home /
Question by
tss · Nov 21, 2012 at 01:04 AM ·
camerajavascriptmovement
Moving Question
I get this error when following this mans tutorial named ETeeski. Does anyone know what the problem is. (i am new to J.S) This is the error.
Assets/PlayerMovementsScript.js(13,15): BCE0024: The type 'UnityEngine.Input' does not have a visible constructor that matches the argument list '(String)'. here is my two scripts I am using.
var walkacceleration : float;
var cameraObject : GameObject;
function Update ()
{
transform.rotation = Quaternion.Euler
(0, cameraObject.GetComponent
(MouseLookScript).currentYRotation, 0);
rigidbody.AddRelativeForce(Input.GetAxis("Horizontal") * walkacceleration, 0,
Input("Vertical") * walkacceleration);
}
and for mouse movement
var defaultCameraAngle : float = 60; @HideInInspector var currentTargetCameraAngle : float = 60; @HideInInspector var racioZoom : float = 1; @HideInInspector var racioZoomV : float;
var racioZoomSpeed : float = 0.2;
var lookSensitivity : float = 5;
@HideInInspector
var yRotation : float;
@HideInInspector
var xRotation : float;
@HideInInspector
var currentYRotation : float;
@HideInInspector
var currentXRotation : float;
@HideInInspector
var yRotationV : float;
@HideInInspector
var xRotationV : float;
var lookSmoothDamp : float = 0.1;
@HideInInspector
var currentAimRacio : float = 1;
function Update ()
{
if (currentAimRacio == 1)
racioZoom = Mathf.SmoothDamp(racioZoom, 1, racioZoomV, racioZoomSpeed);
else
racioZoom = Mathf.SmoothDamp(racioZoom, 0, racioZoomV, racioZoomSpeed);
camera.fieldOfView = Mathf.Lerp(currentTargetCameraAngle, defaultCameraAngle, racioZoom);
yRotation += Input.GetAxis("Mouse X") * lookSensitivity * currentAimRacio;
xRotation -= Input.GetAxis("Mouse Y") * lookSensitivity * currentAimRacio;
xRotation = Mathf.Clamp(xRotation, -90, 90);
currentXRotation = Mathf.SmoothDamp(currentXRotation, xRotation, xRotationV, lookSmoothDamp);
currentYRotation = Mathf.SmoothDamp(currentYRotation, yRotation, yRotationV, lookSmoothDamp);
transform.rotation = Quaternion.Euler(currentXRotation, currentYRotation, 0);
}
Comment
I honestly do not know why my code still shows up funky. I am truly sorry.
Best Answer
Answer by DaveA · Nov 21, 2012 at 01:36 AM
Input("Vertical") should be Input.GetAxis("Vertical")