|
Hellow, I'm trying to make a Camera in Orhtographic and make its focus on y and x plane. But I want to delay the focus as to create a damping motion in the camera movement. How would I achieve that?
(comments are locked)
|
|
You can use whatever damping function you feel appropriate, but generally, you would repeat:
If you threw it into a coroutine with a wait at the start, you could add inital delay and other things, but generally that's it. Here is a simple damp function that will do generally what you need using Vector3.SmoothDamp:
It's been written to work for both orthogonal and perspective cameras. If you want, you can apply some optimization specifically for orthogonal because you wouldn't need to calculate viewport points for an orthogonal camera. Thanks this was just what I was looking for! -Rov
May 20 '12 at 10:36 PM
Rovalin
works perfect! thanks
Jan 10 at 08:30 AM
Seyyed
(comments are locked)
|
|
Here is Scott's answer in C#
(comments are locked)
|
|
This is probably not needed at this point but just in case someone stumbles upon this answer, this is the modified code needed to lock the Y-Axis of the camera, just like an old school platformer. All original code by Scott Kovacs.
(comments are locked)
|
|
I would like to add, if rigidbody object you folow moves not smoothly (jittery), even if camera moves smooth. Turn on Interpolation in properties of rigid body. I couldn't figure out this for months ( You can read more about this here: http://docs.unity3d.com/Documentation/ScriptReference/Rigidbody-interpolation.html +1 to this, thanks so much. I tried so many things to figure out why this was happening. No amount of smoothing was helping.
May 01 at 10:41 AM
JGriffith
(comments are locked)
|
