Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: sebaslive on March 27, 2014, 11:07:36 PM

Title: Camera Zoom
Post by: sebaslive on March 27, 2014, 11:07:36 PM
Hi All, I need infinite wisdom here! I want the camera to zoom based on the velocity but I have some issues. I have been trying to turn this script to playmaker but the mathf.clamp01 is strange. So is the moveTowards based on floats and not vector3???

Code: [Select]
if (target.rigidbody != null && cam != null) {
float spd = target.rigidbody.velocity.magnitude;
float scl = Mathf.Clamp01((spd - minZoomSpeed) / (maxZoomSpeed - minZoomSpeed));
float targetZoomFactor = Mathf.Lerp(1, maxZoomFactor, scl);
cam.ZoomFactor = Mathf.MoveTowards(cam.ZoomFactor, targetZoomFactor, 0.2f * Time.deltaTime);
}
}

Help!!!

Title: Re: Camera Zoom
Post by: sebaslive on April 03, 2014, 01:18:55 PM
bumpy
Title: Re: Camera Zoom
Post by: Graham on April 03, 2014, 03:46:41 PM
Also curious about this myself.
Title: Re: Camera Zoom
Post by: sebaslive on April 07, 2014, 09:58:31 AM
I know the move towards needs its own mathf custom action but how does the mathf clamp work? It has 4 different variables doing operations to get one result. How would that translate to playmaker?