• 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 N1warhead · Mar 25, 2017 at 03:15 PM · rigidbodyrigidbody physics

Rigidbody acting different on two different objects

Hey guys, I'm having a weird problem.

Okay, I just have a rigidbody with a script that does AddRelativeTorque. Okay, well here's my issue.

I have two objects (old spaceship and new spaceship).

Old Spaceship - Controls work exactly how I want (Arcade like controls). New Spaceship - (Copied script + Rigidbody and pasted to new ship).

Old Spaceship - works exactly how I like. New Spaceship - It's as if it's ignoring all my Drag and Angular drag and spins like a billion miles per hour.

Rigidbody Info:

Mass = 10. Drag = 1 Angular Drag = 2. Interpolate= Interpolate.

VIDEO BELOW

https://www.youtube.com/watch?v=RQ893URTEi0

Comment
Add comment · Show 2
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 ZachRoman121 · Mar 25, 2017 at 05:28 PM 0
Share

Can you post your code?

avatar image N1warhead · Mar 25, 2017 at 06:01 PM 0
Share

Not that it will really help, because it shouldn't matter because it's pretty generic. But here it is anyways... I don't see what could possibly make it work different for a different model only.

There's literally nothing different whatsoever, it's only a different model. But here's the code. $$anonymous$$aybe there's something in there that could explain why just a model would react different do it that I'm just not seeing.

 public float speed;
     public float sideThrusterForce;
     public float yawSpeed;
     public float pitchSpeed;
 
     public Rigidbody myRigid;
     float decelerationTime = 1.0f;
 
     private bool airBrakes;
 
     private Health health;
 
     void Start(){
         health = GetComponent<Health> ();
         Cursor.lockState = CursorLock$$anonymous$$ode.Confined;
         Cursor.lockState = CursorLock$$anonymous$$ode.Locked;
         Cursor.visible = false;
     }
 
     void OnCollisionEnter(Collision col){
         health.DoDamage (10);
     }
 
     void FixedUpdate () {
         myRigid.velocity = Vector3.Clamp$$anonymous$$agnitude (myRigid.velocity, speed);
         if (!airBrakes) {
             myRigid.AddRelativeForce (Vector3.forward * speed);
         }
 
         if (airBrakes) {
             myRigid.AddRelativeForce (-Vector3.forward * speed);
         }
 
         myRigid.AddRelativeTorque ((Input.GetAxis ("$$anonymous$$ouse Y")) * yawSpeed, 0, (-Input.GetAxis ("$$anonymous$$ouse X")) * pitchSpeed);
 
         if (Input.Get$$anonymous$$ey ($$anonymous$$eyCode.A)) {
             myRigid.AddRelativeTorque(0,(Input.GetAxis("Horizontal") * yawSpeed * 2),0);
         }
         if (Input.Get$$anonymous$$ey ($$anonymous$$eyCode.D)) {
             myRigid.AddRelativeTorque(0,(Input.GetAxis("Horizontal") * yawSpeed * 2),0);
         }
 
         if (Input.Get$$anonymous$$ey ($$anonymous$$eyCode.W)) {
             myRigid.AddRelativeForce (Vector3.forward * speed * 3);
         }
 
         if (Input.Get$$anonymous$$eyDown ($$anonymous$$eyCode.S)) {
             airBrakes = true;
         }
 
         if (Input.Get$$anonymous$$eyUp ($$anonymous$$eyCode.S)) {
             airBrakes = false;
         }
 
         if (Input.Get$$anonymous$$ey ($$anonymous$$eyCode.Q)) {
             myRigid.AddRelativeForce (Vector3.left * sideThrusterForce);
         }
         if (Input.Get$$anonymous$$ey ($$anonymous$$eyCode.E)) {
             myRigid.AddRelativeForce (Vector3.right * sideThrusterForce);
         }
         if (Input.Get$$anonymous$$ey ($$anonymous$$eyCode.Space)) {
             myRigid.AddRelativeForce (Vector3.up * sideThrusterForce);
         }
         if (Input.Get$$anonymous$$ey ($$anonymous$$eyCode.C)) {
             myRigid.AddRelativeForce (Vector3.down * sideThrusterForce);
         }
     }
 }

1 Reply

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

Answer by N1warhead · Mar 26, 2017 at 11:30 AM

Figured it out finally guys... I tried to use a Capsule Collider and apparently it messes with the way the physics work, so I did a Convex Mesh collider and now it works just right...

Not sure if that's a bug or normal. But it works lol.

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

81 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

Related Questions

Plane CollisionWheels keep jumping around 0 Answers

Rigidbody climbing stairs 2 Answers

Move rigidbody to position and still have forces act on it 0 Answers

Dual conveyor to turn object 0 Answers

VR Sword Physics, how to add force or velocity to the sword for impact when it hits an object 1 Answer


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