accessing height damping

Hello
this is a piece of the boatscript from the vehicles examples. Im trying to access the damping aspect of the smooth follow script. This (see last line) doesnt cut it even though the colours look right in unitron. Couldnt find any script ref on this:

function SetupCamera() {
	if(Camera.main.GetComponent(SmoothFollow) != null)
	{
		Camera.main.GetComponent(SmoothFollow).enabled=true;
		Camera.main.GetComponent(SmoothFollow).target=transform;
		Camera.main.GetComponent(SmoothFollow).distance=35;
		Camera.main.GetComponent(SmoothFollow).height=12;
		Camera.main.GetComponent(SmoothFollow).height damping=3;
	}

thank you
AC

Variable names in JavaScript and C# can’t have spaces in them. So you’re looking for heightDamping. You can see it in Assets/Standard Assets/Camera Scripts/SmoothFollow.js line 19. Also, doing GetComponent over and over isn’t very efficient. It’d also look cleaner if you just did this:

function SetupCamera() {
	var smoothFollow = Camera.main.GetComponent(SmoothFollow);
	
	if (smoothFollow) {
		smoothFollow.enabled = true; 
		smoothFollow.target = transform; 
		smoothFollow.distance = 35; 
		smoothFollow.height = 12; 
		smoothFollow.heightDamping = 3;
	}
}

Cheers,
-Jon

Thanks Jon. I couldnt get it to compile though, but thats just me , code and me is like cats in water.

Coding does my head in.

AC

Go ahead and paste the full script. :slight_smile:

-Jon