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
4
Question by SYRSA · Sep 12, 2013 at 02:58 PM · rigidbodybugkinematic

Why does rigidbodies lag behind when connected to kinematic rigidbodies?

The title says it. When I attach a rigidbody to a kinematic rigidbody with a joint inside a vehicle, it lags behind when I drive the vehicle forwards. Why does it do this?

Here is a picture showing it, the kinematic rigidbody is controllable by a script with the mouse because it's a turret. And the turret itself is a physical rigidbody that is attached to the kinematic rigidbody. But it lags behind when I travel fast. Yet again, why does it do this?

alt text

720.jpg (126.6 kB)
Comment
Add comment · Show 8
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 _MGB_ · Sep 12, 2013 at 03:03 PM 1
Share

Are you updating the kinematic body in FixedUpdate? If not there can be disparities.

avatar image SYRSA · Sep 12, 2013 at 03:09 PM 0
Share

The kinematic Rigidbody is just a gameobject parented to the truck.

avatar image SYRSA · Sep 12, 2013 at 04:29 PM 0
Share

It doesn't matter what joint I'm using, you can do and see for yourself. Open up a new project, create a gameobject, make it a rigidbody. Then make 2 new rigidbodies (make them both not use gravity) and parent them as childs inside the main gameobject. Take the first rigidbody and make it kinematic, and then attach the second rigidbody to the kinematic rigidbody with any joint. Drop the main gameobject and see what happens.

avatar image SYRSA · Sep 12, 2013 at 04:47 PM 0
Share

It even happens to fixed joints, I have tested it. What is so important about my config?

avatar image SYRSA · Sep 12, 2013 at 06:13 PM 0
Share

So, is there any solution to this problem? I'd really like to have my turret to physically react with the environment.

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
4

Answer by jcman · Jan 14, 2018 at 08:59 PM

4 years late, but since I just came across this problem I may as well answer!

There are 2 reasons that this can happen as far as I can see:

  1. the kinematic body is being moved in the Update function and not FixedUpdate. Since the Physics system updates after each FixedUpdate, and Update is after Physics, that would cause a one-frame lag.

  2. the kinematic body which has the dynamic body attached to it is itself the child of a rigid body (the trailer in your image). In this case, the kinematic body's position is not updated as part of the physics update because physics does not know about the attachment. Instead the kinematic body's position is updated after physics, but that's too late for it to affect any joints attached to it.

Your problem is likely the second one, and I think that unfortunately the only way to retain the physics connection is to have dynamic bodies all the way through. So, change your kinematic body to a non-kinematic one and attach it to its parent with a FixedJoint.

Note you can set the ConnectedMassScale on a joint to very small if you want to prevent the child object from affecting the motion of the parent. If that sounds the wrong way round it's because ConnectedMassScale is a scale on the inverse mass, so what we are doing is pretending that the connected (parent) object has extremely large mass.

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

19 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

Related Questions

Problem with a RigidBody and IsKinematic... I think 1 Answer

Obstacles for kinematic rigidbody 2 Answers

Rigid Body collision problem 2 Answers

Kinematic rigidbody movement. 2 Answers

Moving a kinematic object a fixed distance over a set time with physics in mind 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