Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 dbokser · Mar 17, 2010 at 03:11 AM · collisionphysicsrigidbodyangularvelocitydynamics

rigid body Clone Instance not behaving like original

Hi. I have a sphere that is being launched from a catapult. I parented the sphere to the catapult so that the dynamics act locally, because the catapult moves fairly quickly and the simulation was flipping out on launch. Parented, the simulation looks nice and realistic, but the problem arises when the catapult moves at all - since it's local, even in mid air the object moves and rotates with the catapult. So, to solve this issue, I instantiated an object upon launch in world space and copy the position, rotation, and velocities with the following code:

cloneObj.rigidbody.useGravity = true; cloneObj.rigidbody.velocity = origObj.rigidbody.velocity; cloneObj.rigidbody.angularVelocity = origObj.rigidbody.angularVelocity; cloneObj.rigidbody.rotation = origObj.rigidbody.rotation;

var currentPos = origObj.position; var currentRot = origObj.rotation;

origObj.position = Vector3(500,0,0); origObj.rigidbody.useGravity = false;

cloneObj.position = currentPos; cloneObj.rotation = currentRot;

The thing is, the simulation on the cloned object reacts differently. When it collides with an object, it seems like it doesn't get the angular velocities the same way and almost has no torque when it bounces off something, and doesn't reverse direction when it hits another object, like the original does. Is there something else I'm not transferring correctly from the original to have the clone behave physically like the original?

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
1

Answer by dbokser · Mar 17, 2010 at 03:25 AM

It seems like I solved it by setting the cloneObj mass to 1. Why would this be? The mass is set to 1 in the prefab anyway, so why would not explicitly setting it change the results of the simulation?

cloneObj.rigidbody.useGravity = true;
cloneObj.rigidbody.velocity = origObj.rigidbody.velocity;
cloneObj.rigidbody.angularVelocity = origObj.rigidbody.angularVelocity;
cloneObj.rigidbody.rotation = origObj.rigidbody.rotation;
cloneObj.rigidbody.mass = 1;

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

No one has followed this question yet.

Related Questions

Collision between player and a ball 1 Answer

Camera gets flung off of the map when the player collides with certain objects. 0 Answers

Rigidbody necessary to use collision detection 1 Answer

Nav Mesh Agent won't fall off the platform? 1 Answer

Character rigidbody collisions 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