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 zeest · Jul 25, 2012 at 08:21 PM · physicsblender

Strange rotation

I made a quick character in blender, imported it in unity, put a capsule collider and a rigidbody on it, and now whenever the character hits the terrain where it is uneven, the character starts spinning in all directions. The project file is attached (change the extension to unityproject, I had to change it because it was saying it was an invalid file type).

help.txt (324.5 kB)
Comment
Add comment · Show 6
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 AlucardJay · Jul 25, 2012 at 08:50 PM 0
Share

$$anonymous$$y guess is that the X-Y-Z-axis in Blender are different from those in Unity (i.e. they point in different directions). You may have to rotate the model and export it again, and test until you find the correct orientation of the models axis to Unity's axis.

Or, cheat and put your model as a child in an empty gameObject and use the scripts on the parent (remember, you'll have to put your collider and rigidbody and scripts on the parent gameObject, not the child model). This is just a guess.

avatar image zeest · Jul 27, 2012 at 02:59 PM 0
Share

I have already rotated the model. Everything works fine until the model is moved towards uneven terrain, at which point the model floats and starts rotating.

avatar image AlucardJay · Jul 27, 2012 at 03:03 PM 0
Share

Then that would be the rigidbody working? Test this by constraining the rotation on the X and Z axis in the rigidbody inspector.

avatar image zeest · Jul 27, 2012 at 03:21 PM 0
Share

It appears it is the rigidbody. After constraining the rotation on X and Z, the model only turns in circles on the Y axis. Will having the rotations frozen prevent me from turning the model using scrips?

avatar image AlucardJay · Jul 27, 2012 at 03:25 PM 0
Share

If you use physics-based stuff like addForce and addTorque then yes. But if you use transform.Rotate then probably not. I really havn't done much physics based stuff, but if I were you I would do a little test. $$anonymous$$ake a script that just rotates the char on one of those axis in an update, if it doesn't rotate, then the constraints do affect transforms. But directly transfor$$anonymous$$g a rigidbody ids not good practice. Perhaps you could lower the center of gravity.

Show more comments

1 Reply

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

Answer by AlucardJay · Jul 27, 2012 at 03:27 PM

Then that would be the rigidbody working? Test this by constraining the rotation on the X and Z axis in the rigidbody inspector.

If you use physics-based stuff like addForce and addTorque then yes having the rotations frozen prevent you from turning the model using scripts. But if you use transform.Rotate then probably not. I really havn't done much physics based stuff, but if I were you I would do a little test. Make a script that just rotates the char on one of those axis in an update, if it doesn't rotate, then the constraints do affect transforms. But directly transforming a rigidbody ids not good practice. Perhaps you could lower the center of gravity.

Comment
Add comment · Show 2 · 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 AlucardJay · Jul 27, 2012 at 04:09 PM 0
Share

A rigidbody uses actual forces. When you modify them without force, the forces that exist get messed up and can have very strange effects.

From the docs :

Scripting

To control your Rigidbodies, you will primarily use scripts to add forces or torque. You do this by calling AddForce() and AddTorque() on the object's Rigidbody. Remember that you shouldn't be directly altering the object's Transform when you are using physics.

source : http://docs.unity3d.com/Documentation/Components/class-Rigidbody.html

Also looking at the script reference, there is no mention of direct transforms in there, raather addForce/Torque and $$anonymous$$ovePosition/Rotation (look under functions) :

http://docs.unity3d.com/Documentation/ScriptReference/Rigidbody.html

Imagine falling then instantly being thrown in the other direction, your internal organs wouldn't like that :D

There is a good script on character controllers with rigidbody's in the UnifyCommunity wiki, but its down at the moment because silly hackers and spammers have nothing better to do... ( so I can't search and give you the direct link right now, sorry)

When it is back online, search here under controllers (from memory) : http://unifycommunity.com/wiki/index.php?title=Scripts/General

Hope this helps (btw I'm $$anonymous$$ $$anonymous$$ay) =]

avatar image zeest · Jul 27, 2012 at 04:19 PM 0
Share

Ok, thanks.

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

6 People are following this question.

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

Related Questions

Object mesh collider acting strange 0 Answers

Need help with character unity+blender 1 Answer

2D 360 degress platformer example needed 0 Answers

blender as asset - animation 1 Answer

Proper Physics With Imported FBX Models 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