Hey, I’m trying to simply translate the camera from one position to the next. I’m getting the error;

Assets/Scripts/InGameGUI.js(471,46): BCE0023: No appropriate version of ‘UnityEngine.Mathf.SmoothDamp’ for the argument list ‘(UnityEngine.Vector3, UnityEngine.Vector3, float)’ was found.

However from my end, the code looks sound.

Anyone have any ideas of what I’ve missed?

function CameraStart ()
	var camStartPosition 	= Vector3 (11.5, 0, -5);
	var camEndPosition 		= Vector3 (0, 0, -5);
	transform.position 		= camStartPosition;
	var getCamSpeed : int = 0;
	getCamSpeed = camSpeed;
	getClock.GetComponent(clock).playTimeEnabled = false;

	camSpeed = 1.0;
	yield WaitForSeconds (7);
	transform.position = Mathf.SmoothDamp(camStartPosition, camEndPosition, camSpeed * Time.deltaTime); 
	//moveCamCenter = true;
	yield WaitForSeconds (5.5);
	getClock.GetComponent(clock).playTimeEnabled = true;
	camSpeed = getCamSpeed;

It seems you mixed up Mathf.SmoothDamp with Vector3.SmoothDamp.

Mathf.SmoothDamp works only on single float values while Vector3.SmoothDamp works on vector3s.

@Ryan got point, you are giving the start position, you should give the current position (which is the same as start position only at the start ) and apply that return value to current position.

You must also give the velocity parameter as reference so that the function can modify it and use the new velocity value next time.

And the 4th param should represent time as float. Something that won’t change.

Also execution order is not correct I think.

So it should be something like this : (c#)

void camStart() {
float smoothTime = 5.5f;
Vector3 camStartPosition = new Vector3 (11.5, 0, -5);
var camEndPosition = new Vector3 (0, 0, -5);
var velocity = new Vector3 (-5, 0, 0);
transform.position = camStartPosition;

void update() {
if(cameraStarted) {
transform.position = Vector3.SmoothDamp(transform.position, camEndPosition, ref velocity, smoothTime );