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 andymads · Dec 03, 2012 at 03:23 PM · camerarigidbodyfixedupdate

Camera update when tracking physics controlled object

We're developing a side scrolling platform endless 'runner' game for mobile.

The character is a rigidbody with colliders and the environment has colliders which the character travels along at a constant rate in the +x axis. To move the character we use Rigidbody.AddForce with ForceMode.VelocityChange (+x axis for running, +y axis for jumping as needed).

This works well for us as the character behaves as we want and we also get all the collision/trigger events we need.

The issue I have is with the camera - it's ok, but could be smoother (the perceived 'scrolling' of the environment could be smoother).

The camera tracks the character but of course the camera frame rate is variable and not the same as the physics update which moves the character. What this means is that each render frame the distance the character has travelled since last time can vary - which leads to the enviroment 'scrolling' in a unsmooth way.

This shows up really bad in the editor on my iMac because the update time is pretty varied each frame. It's much better on my iPad because of the mostly consistent update time (60fps) but could be better.

Can anyone offer some advice?

Comment
Add comment · Show 3
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 Owen-Reynolds · Dec 03, 2012 at 03:43 PM 0
Share

Have you looked at using FixedUpdate?

avatar image andymads · Dec 03, 2012 at 03:55 PM 0
Share

You mean for camera positioning? Yes, I already do that. I believe that the issue is because the number of physics steps can be different between renders.

avatar image danilonishimura · Dec 03, 2012 at 04:39 PM 1
Share

One thing that you can do, is to create an empty gameobject that will follow your character using some smoothing algorithm, and you use this gameobject as reference point for your camera tracking. It can even look better than to keep your character exactly on the center of your screen all time and that hiccups of updating the position and rotation of the camera to the new values.

(dumb smooth sample)

targetPosition = newPosition + oldPosition - (oldPosition - newPosition) * 0.1f;

0 Replies

· Add your reply
  • Sort: 

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

11 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Jittery thid-person camera follow behaviour 0 Answers

Movement object same distance as touch movement 0 Answers

vector3.forward doesn't work when used in Rigidbody? 2 Answers

Particles lag/stutter - choppy movement 3 Answers

Camera jitters / lag behind when jumping or falling 2 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