Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by David C · Jun 17, 2012 at 04:49 PM · cameravector

Copy position Smoothing

Hello,

I have been at this issue for a couple of days now and its time I ask the great community. I am making a flying game with a third person follow camera. I have an camera parented to an empty which is copying the rotation of the plane. In order to actuallly follow the plane I then have it so the empty copies the position of the plane as the empty is on the planes pivot point.

It was a very jerky follow camera so naturally I added some smoothing like so:

 MainCamera.position = Vector3.Slerp(MainCamera.position,transform.position, Time.deltaTime * SmoothTime);

This works fine but my issue is the camera is falling behind, and the faster the plane travels the more the camera falls behind. Turning the "SmoothTime" down has no effect and turning it up works until a certain value (45 atm). After the value is reached it becomes jerky again.

How can I stop the camera from falling behind while still retaining the smoothing?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by Wolfram · Jun 18, 2012 at 09:49 AM

Put your code in LateUpdate(), to prevent execution order conflicts - all scene transformations should happen first, and at the last possible moment adapt your camera position to the current situation.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image David C · Jun 18, 2012 at 11:19 AM 0
Share

Thanks I fixed it by changing the way the planes moves from Translate to ConstantForce. This seemed to work but Thank you for your help!

avatar image David C · Jun 18, 2012 at 12:11 PM 0
Share

Just Tested it, Late Update Works even better! Thank you

avatar image
0

Answer by asafsitner · Jun 17, 2012 at 07:48 PM

I think you want to use Lerp as in Linear Interpolation and not Slerp as in Spherical Linear Interpolation. The latter is used for rotation smoothing, not position.

You can use Vector3.Distance to determine when the camera is falling behind too much and accelerate/decelerate it accordingly, or make SmoothTime relative to the plane's speed.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image David C · Jun 18, 2012 at 09:40 AM 0
Share

Thanks for your help, I have tried making SmoothTime relative to the planes speed, but as I said when smoothtime gets to high it jitters again

avatar image David C · Jun 18, 2012 at 09:45 AM 0
Share

CHanging to Lerp doesnt work either, but thanks

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Use lookAt and transform.translate at the same time 1 Answer

FPS Camera moving by my left mouse button 1 Answer

More Effective Camera Switching 1 Answer

How to get the look (or forward) vector of the camera? 4 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges