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 Scramasaxe · Jun 23, 2012 at 09:00 AM · rigidbodyvelocityhingejoint

hinge joints and velocity

So I have an oriental dragon based on hinge joints. The tail and the head are Kinematic. The rest isn't. When I pause the game I use the function below to switch the other hinge joints to kinematic, that way they don't all around.

This all works great until I unpause the game and set the rigidbodies back to being non kinematic. At this point the velocity of the dragon seem to double. I've checked and constrained transforms, but can't figure it out.

Any help would be greatly appreciated.

 Transform SetActiveOnHingeJoints(Transform current,bool abool)
 {    
     if(current.rigidbody !=null && current.name!="Head" && current.name!="Tail")
     {
         if(abool)
         {
             current.rigidbody.isKinematic            =!abool;
             current.rigidbody.velocity                 = new Vector3(0,0,0);
             current.rigidbody.angularVelocity         = new Vector3(0,0,0);
         }
         else
         {
             current.rigidbody.isKinematic            =!abool;
         }
     }

     // search through child bones for the bone we're looking for

     for (int i = 0; i < current.GetChildCount(); ++i)
     {
         Transform found                         = SetActiveOnHingeJoints(current.GetChild(i), abool);
         if (found != null)
             return found;            
     }
     return null;
 }
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 whydoidoit · Jun 23, 2012 at 09:03 AM

You shouldn't need to set them to kinematic on pausing the game. Instead set Time.timeScale to 0 - then reset it to 1 when the user unpauses.

Comment
Add comment · Show 4 · 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 Scramasaxe · Jun 23, 2012 at 09:45 AM 0
Share

Its a good answer, but I need certain physics based object to keep moving while the dragon freezes.

Though what you've said has given me an idea....

avatar image whydoidoit · Jun 23, 2012 at 09:47 AM 1
Share

Ah ok :) So in that case you need to take a copy of all of the rigidbody velocities (angular etc) on pausing and play them back on after you set is$$anonymous$$inematic = false.

avatar image Fattie · Jun 23, 2012 at 11:08 AM 0
Share

precisely, WD has explained the situation in that comment

it's actually a huge nuisance in unity, they should have TWO CONCEPTS

"rolling pause" ... perhaps "freeze" ... continues physically where it was

"pausey pause" .. basically all the physics disappear when you pause

one huge problem here is....a

lmost every time othe r than in Hello World,,

your rigs will have some sort of "rest state". so, in reality, whenever you do the "pausey pause" offered by Unity3D, in fact, you also have to typically return them to some sort of rest state (positions, etc, animations, sounds, who knows what)

it's a good example I$$anonymous$$O of how some stuff in Unity is essentially simplified, and in basically 100% of real games there is "something else you have to do" in terms of some functions, paradigms...

avatar image whydoidoit · Jun 23, 2012 at 11:11 AM 0
Share

Whenever I report to my partners on progress in my game and what I'm working on - I always get the "but didn't we spend a ton of cash on a game engine?" question. I try to explain that physics, 3D rendering, shaders, effects, input management, scene management, shadows, lighting etc etc are all very hard to write - but then there is the weeks spent saving a level and they ask "don't all games need a save feature?" Yep

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Velocity powered rigidbody on a moving platform without parenting. 3 Answers

Is there a way to tell if a hinge joint is moving? 2 Answers

AddRelativeForce not working correctly 1 Answer

Simulate a ball bouncing off of a linecast? 0 Answers

Rigidbody speed / Velocity issue 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