playMaker

Author Topic: Camera Zoom  (Read 2256 times)

sebaslive

  • Hero Member
  • *****
  • Posts: 572
    • Frame Tale Studios
Camera Zoom
« 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!!!

« Last Edit: March 30, 2014, 02:37:06 AM by sebaslive »
All my VR games use Steam VR Playmaker Toolkit: http://u3d.as/u20
And Oculus Touch Playmaker Toolkit: http://u3d.as/QT5


Follow me @sebasRez

sebaslive

  • Hero Member
  • *****
  • Posts: 572
    • Frame Tale Studios
Re: Camera Zoom
« Reply #1 on: April 03, 2014, 01:18:55 PM »
bumpy
All my VR games use Steam VR Playmaker Toolkit: http://u3d.as/u20
And Oculus Touch Playmaker Toolkit: http://u3d.as/QT5


Follow me @sebasRez

Graham

  • Sr. Member
  • ****
  • Posts: 340
  • I Love Playmaker!
    • Portfolio
Re: Camera Zoom
« Reply #2 on: April 03, 2014, 03:46:41 PM »
Also curious about this myself.
More templates on the Unity Asset Store!

Disclosure: We are using affiliate links to our assets; we may receive a commission for purchases made through them. This helps us to continue developing and maintaining great products!

sebaslive

  • Hero Member
  • *****
  • Posts: 572
    • Frame Tale Studios
Re: Camera Zoom
« Reply #3 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?
All my VR games use Steam VR Playmaker Toolkit: http://u3d.as/u20
And Oculus Touch Playmaker Toolkit: http://u3d.as/QT5


Follow me @sebasRez