Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started 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???
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!!!
-
bumpy
-
Also curious about this myself.
-
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?