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 Wolfram · Aug 24, 2010 at 03:00 PM · animationmovementphysicsraycast

Can I animate objects/cameras in Update() without breaking Physics.Raycast?

Since the beginning of our project, we have been moving and animating both objects and camera always in Update() and/or LateUpdate() (always scaled by Time.deltaTime to compensate for framerate).

However, Physics.Raycast() no longer returns correct and reliable results when doing so - no matter where I do the Physics.Raycast() (FixedUpdate/Update/LateUpdate), it sometimes passes through objects that just moved into the path, and sometimes it works.

Now I noticed that it does work reliably when I do all my scripted animations in FixedUpdate() instead of Update() - again, independently from where I call Physics.Raycast.

So my main question would be: Is this how it needs to be done? Are you forced to do all object transformations in FixedUpdate, if you want to use Physics.Raycast? Or am I missing something, or is there a workaround?

Sometimes some of our objects (or the camera) are also animated using animations created with the Unity AnimationEditor. But when I script-animate the camera in FixedUpdate(), an object with a Unity animation will look extremely jerky. Is Animation.animatePhysics the proper way to fix this? Or is there some other way to influence the read-only value AnimationClip.frameRate (which appears to be 60 for Unity-animatinos, independent of Time.fixedDeltaTime)?

(see here for detailed info and testcase)

Comment
Add comment · Show 1
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 Mackuss · Jul 01, 2011 at 11:01 PM 0
Share

I would enjoy an answer to this as well!

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Panopolos · Jun 24, 2013 at 01:54 AM

I don't know where you're calling for the Raycast, but when I ran into this problem (checking "Animate Physics" broke my Raycast), I changed the call of the Raycast from Update to LateUpdate. I had no problems after that.

Comment
Add comment · 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
0

Answer by davidjohn123 · Jun 07, 2016 at 11:01 AM

please answer me http://answers.unity3d.com/questions/1198965/detecting-raycast-on-moving-object.html#comment-1199022

Comment
Add comment · 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

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Character still walking when no key is already pressed 1 Answer

physically realistic animated character movement 3 Answers

My animation and player movement are messing with each other 0 Answers

Animation causes rigidbody to move 0 Answers

How do I play the unity free walk animation on raycast(click) and continue to play until the character has arrived at the raycast destination? 0 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