Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by GD-DavidStrife7 · Oct 03, 2016 at 10:27 PM · animationanimatorlogicupdate-order

Accurate Object Movement On A Plane Relative To Moving/Animated Camera

I'm creating an old school arcade shmup in the style of R-Type, Gradius, G-Darius, Ikaruga etc.

The game plays out in a 2.5D manner, where all the ships and bullets on screen happen on a 2D plane, but all of the objects are parented to the main game camera, which is being animated on a track that flies around the level, making for an interesting background.

My question is, if I'm animating the camera via the animator window, and I want all objects to stick to a 2D plane that's parented to the game camera regardless of how it's rotating etc., how would I do that?

The problem I'm having is I'm programming instructions for player movement to look at its current position, and update its position from its current position towards a vector that is calculated along its local forward axis (which means it's calculated relative to the camera on a theoretical plane). When the camera is rotating wildly or quickly though, the ship steers off center, and ends up in a weird position depth wise, and sometimes at a strange rotation because of some out of sync timing with how the animator is updating the camera position.

I'm pretty sure it's because the ship is checking where it is and calculating its next movement, and when it updates the movement on the next frame, the camera is simultaneously moving itself, so the ship has maybe moved forward in a straight line, but the camera has slightly rotated since.

My big question = When does the animator update itself?

I've animated the camera with unity's built in animator, when does it update the position with the new keyframe? Is it during early update, normal update, late update? Somewhere in between? The next question would be, where should I place my movement code to update the ship's position, to ensure it calculates and applies movement AFTER the camera has moved to its newest keyframe via the animator?

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by theANMATOR2b · Oct 04, 2016 at 07:50 PM

Do these two links help?

https://docs.unity3d.com/Manual/ExecutionOrder.html

https://docs.unity3d.com/Manual/class-Animator.html

Animator component - Update mode

Comment
Add comment · Show 1 · 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 GD-DavidStrife7 · Oct 04, 2016 at 07:57 PM 0
Share

So from what I'm reading, the Internal Animation Update is where the animation component moves the camera, which is just after the regular update call?

However, I have the option to change it to go just after the fixedupdate call?

So I would update positions of objects first in Update, and then the animation component would move the camera, which in turn moves the just-recently moved objects :)?

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

138 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Logic for a lot of animations 0 Answers

creating animator transitions using script 0 Answers

Unity Animation OnStateExit doesn't work when i add conditions 0 Answers

Proper way to implement animations 0 Answers

Animation (from animator) only plays through when scene tab is opened 1 Answer


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