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
1
Question by MithosAnnar · Jun 03, 2012 at 11:08 AM · 2dphysicsjumpjoints

Problem with joints

I am trying to make a 2d game. I have a character who jumps made of segments, one big and four little ones. all of the segments are planes with colliders and rigid-bodies attached. I want the little segments to swerve behind the big one when i jump. To accomplish this I have attached hinge joints to most of the segments, but this has not worked, the segments swerve but when he jumps he bowls himself over and usually lands on his head.

Does anyone know how I would implement this effect?

any help would be greatly appreciated.

EDIT: for clarification my character is a worm made of five segments, all of which are children of one empty game object representing the character as a whole. The biggest segment is at the front and is the creature's head while the four little ones are the tail. My movement script which I have placed on the head segment, works by changing the head segment's velocity, so the rigid bodies on the tail segments are interfering with my jumping. I would like the head to be the centre of physics and interaction with the world while the tail just gently swerves behind the head when he jumps, not affecting the movement at all.

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 Fattie · Jun 07, 2012 at 02:28 PM 0
Share

make the tail have zero mass. (ie, don't use the physics engine for the tail). add two lines of code to make it "wiggle gently".

it's that simple

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Owen-Reynolds · Jun 04, 2012 at 04:15 PM

NOTES: The tail wants to spin the body around, and even a very light tail is enough to do that. Like a 300 pound ice-skater who throws out a 10-pound arm to start spinning. For real, an animal is moving the tail in a very precise way to control their spin. In other words, instinctively running physics "backwards" in it's head. I don't think even state-of-the-art robotics can do that, yet. So, there's no way Unity can make a correct "active" tail.

SOLUTION: The trick to is to wall off the tail from the body. This worked for me: add a child "rump" to the head segment. It could be an empty or a model. Give it a rigidbody set to isKinematic (so, it's not really a rigidbody, but counts as one for technical reasons. See why later.)

For the tail sections, same as before, but connect the first one to the new "rump" (the slot for connectedBody requires a Rigidbody. Using an isKen RB as a frozen connection spot is a trick from the Docs.)

The tail is now stuck to a single point in space, which just happens to follow to head. One problem I had is that the tail can still bend and smack the body, knocking it around. You could just make the joints stiffer. Or, an absolute solution would be to make a wide collider between head/tails on a layer only the tails can hit.

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 MithosAnnar · Jun 07, 2012 at 01:33 PM 0
Share

Thanks Owen, your the best!

avatar image
0

Answer by Owen-Reynolds · Jun 03, 2012 at 03:42 PM

Try increasing the main body's Mass, in the rigidbody (can do through the Inspector.)

Unity just sets everything to 1 kilogram(*), regardless of how large the collider is(**). This means physics is acting as if your tail segments are brass and your body is a giant feather pillow -- easily pulled around by the tail.

(*)Kilos are mass and weight? That doesn't sound right.

(**) Maybe they should throw a card for "set default Mass proportional to Collider volume" at the bottom of the scrum pile. But then they'd want to recalc when the collider was resized, but only if they're still on default. Instantiated prefabs have a "never been touched by user" flag. Do things such as Mass have one?

Comment
Add comment · Show 3 · 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 Fattie · Jun 03, 2012 at 04:31 PM 0
Share

Owen, they could possibly avoid that problem (and eli$$anonymous$$ate 30% of all questions on this forum) by simply:

having an enormous flashing, red and green, neon alert that appears - full screen animated glowing neon - with massive alarm sound effects playing in the background which says in all major world languages:

  1. Hello! Game engines do physics. Do not start calculating any physics.

  2. You must use real-world sizes. You must use real-world sizes. You must use real-world sizes. You must use real-world sizes. You must use real-world sizes.

  3. You must set mass properly.

At the bottom, have a "Do not show this again" button, but actually don't make it do anything. Just keep showing that alert - forever!

avatar image MithosAnnar · Jun 04, 2012 at 06:57 AM 0
Share

I have tried fiddling with the mass, but while he now usually lands on his feet he still acts like a maniac when he's in the air. It seems to me that having rigid bodies my on the tail segments, no matter how small or large the mass interferes with jumping causing unrealistic and poor looking movement.

avatar image fafase · Jun 04, 2012 at 07:16 AM 0
Share

You could add a jump animation so that the members move according to it while in the air.

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

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

2D (With Planes) Jump Script 0 Answers

Rigidbody2d not falling once in the air 1 Answer

2d crane physics hinge joint 2d 0 Answers

Incremental jump while pressing Jump button 0 Answers

Sphere Goes Crazy 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