- Home /
Question by
kewlchickin · Jan 01 at 09:22 PM ·
3dcamera follow
How do i make an object following the camera offset?
I'm wondering if I can make an object following the camera take a little longer to catch up to the camera. the current thing I'm doing is just having the object as a child to the camera but I don't like how it looks.
Comment
Best Answer
Answer by thereadypunk · Jan 01 at 09:45 PM
Hi. To do something like this, I would recommend using lerp. Lerp allows you to smoothly do things like translation, rotation, and scale. To do this, you need a transform reference to the camera. Then in update you need to do:
transform.position = Vector3.Lerp(transform.position, camera.position, (enter number here between 0 and 1. I recommend 0.125));
Lerp is a really useful thing, you should use it in the future!
Answer by kewlchickin · Jan 02 at 03:18 AM
I had to do a little more coding (just a second line of pretty much the same thing) but now i got the rotation working, so thank you!
Your answer
