• 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 aducceschi · Mar 09 at 12:56 PM · collisionphysicsrigidbodymoveposition

Rigidbody.MovePosition/MoveRotation Hits far away colliders

Hello!

I've been dealing with this issue:

When I move an object with Rigidbody.MovePosition or Rigidbody.MoveRotation very fast, it will trigger a collision with nearby objects that are actually never in contact with it.

  1. The MovePosition function is being called from Fixed Update.

  2. The Rigidbody is set to Collision: Continuous Dynamic, Interpolate: Interpolate and IsKinematic: true.

  3. It uses a Mesh Collider but I have the same issue with other types of colliders.

I've tried changing all settings but nothing worked. I've also tried changing the Default Contact Offset value in Project Settings > Physics. Changing the Fixed Timestep in the Time settings didn't work either. Also I'm locked at 72 fps so the framerate isn't an issue.

I say again, this occurs when I move the object REALLY FAST, (I'm doing it in VR but this also happens by just moving the object through the arrows in the editor). It seems like either the collider becomes bigger when moving fast or that the collider and the mesh missalign for whatever reason.

This does not happen if I move the object by teleporting it with Rigidbody.position, but that makes the collider miss sometimes the actual target collider.

For anyone wondering, the code is this (I'm just teleporting it to the hands position):

myRigidbody.MovePosition(target.transform.position);

Thanks for all answers and for your time.

Alfonso

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
0

Answer by keroltarr · Mar 09 at 02:59 PM

based on your description I wonder that even with 72 fps it is calculating given the extreme velocity of the object that it will have collided with the other object before it renders the next frame. if you are already scaling your movement by time.deltatime you might need to clamp the position to limit how far it can go or clamp speed to limit how fast it can go.

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 aducceschi · Mar 10 at 08:16 AM 0
Share

Thanks for the answer! I'm moving the object in the FixedUpdate. I can't clamp the position because it would break the immersion of the game unfortunately. Still, this seems to be more like a Unity bug the more I look into it.

avatar image
0

Answer by Edy · Mar 09 at 04:46 PM

Try increasing the physics update rate. Default rate is 50 Hz, I'd try with 100 Hz.

The physics update rate is configured at Project Settings > Time > Fixed timestep. Default is 0.02 (50 Hz). Set it to 0.01 for 100 Hz. This may have some impact in the performance.

Physics "predicts" the collisions based on the speed of the objects. The lower the physics update rate, the farther away the contacts will have to be checked for. Increasing the physics rate would reduce the distance at which physics needs to check.

Visual framerate is irrelevant. Physics will always run at the configured update rate regardless the render update rate.

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 aducceschi · Mar 10 at 08:13 AM 0
Share

Thanks for your answer! I already tried to increase the physics update rate, but it did not fix the issue. I even went as far a to make it update 1000s of times per frame.

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

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

Related Questions

is there a way to move a rigidbody with something like moveposition without clipping through collider? 1 Answer

Calling Rigidbody.MovePosition, no movement at all 4 Answers

Collision interpenetration and object getting stuck 1 Answer

Non-convex MeshCollider with non-kinematic Rigidbody? 2 Answers

How do I "remove/disable" collision? 3 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