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 /
avatar image
0
Question by kangawallapuss · Jan 10, 2018 at 03:55 AM · physicsrigidbodybug-perhapskinematicmoving platform

Moving kinematic rigidbody causing strange physics behaviour, is this a bug?

Since updating to Unity 2017 I have noticed a strange physics behaviour. My game uses moving platforms that are kinematic rigidbodys that move with Rigidbody.MovePosition(). This method is used so that the moving platforms work perfectly in the physics system, updating their position will not work perfectly with continuous collisions.

Moving a physics based player character to where one such moving platform has been often causes its physics to glitch out.

I made a simple mockup example that has the same problem:

I created 2 cubes, one made large and flat to serve as ground, the other gets a rigidbody that is kinematic and has continuous collision and the following script attached:

 using UnityEngine;

 public class KinematicOscilate : MonoBehaviour {

     public float timeScale = 0.04f;
     public Vector3 distance = new Vector3(0f,6f,0f);

     float time = 0f;

     Rigidbody rig;
     private void Start()
     {
         rig = GetComponent<Rigidbody>();
     }

     void FixedUpdate()
     {
         time += Time.deltaTime * timeScale;
         if (time > 1)
         {
             time--;
         }

         rig.MovePosition( distance * Mathf.Sin(time * Mathf.PI * 2) );
     }
 }

Then I created a sphere. Added a rigidbody with continuous dynamic collision and added this script:

 using UnityEngine;

 public class BallMovement : MonoBehaviour {

     public float multiplier = 1000f;
     Rigidbody rig;

     void Start () {
         rig = GetComponent<Rigidbody>();
     }
 
     void FixedUpdate () {
         rig.AddForce(new Vector3(Input.GetAxis("Horizontal"), 0f, Input.GetAxis("Vertical"))* multiplier * Time.deltaTime * rig.mass);
     }
 }

This ball and the moving platform are placed on the ground in line with one another.
When running this example, after waiting for the cube to rise, and then fall through the ground, moving the ball back and forth where the cube has been causes it to glitch out and get stuck in the ground.

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 kangawallapuss · Jan 11, 2018 at 11:11 AM 0
Share

Thinking the issue could be related to the new deferred physics transform updates I tried inserting Physics.SyncTransorms in various places with no success.

Going back to Unity 5 has resolved my issue. However the same glitchy behaviour still occurs in both Unity 5 and Unity 2017 when using animate physics to control the platform ins$$anonymous$$d of Rigidbody.$$anonymous$$ovePosition() in FixedUpdate.

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

145 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

Related Questions

How can I make character become a ragdoll with isKinematic? 1 Answer

Rigidbody triggers are pushing a CharacterController.. 3 Answers

Freeze Rotation constraints doesn't work. 2 Answers

Kinematic containing non-Kinematic 1 Answer

Collision Detection for Kinematic Rigidbodies 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