• 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
Question by lackofwords · Jun 09, 2016 at 02:49 PM · physicsforcejointbreakridigbody

Hammer Swing - Joint Break Force and Hammer Object

I'm thinking as to how to approach this Hammer Swing concept while maintaining the joint's individual break force values.

So the setup is you have a clump of balls jointed together with each joint having a different break force. And you have an Hammer that follows the mouse cursor, which you can use to smash at the clump of balls.

This Hammer is not a Kinematic object, which means the game physics still applies to it. But, no matter how fast you swing your Hammer, it isn't going to break the clump apart.

I'm assuming this is because the way it's being updated to the mouse position is just by setting the rigidbody position, which doesn't give the object any amount of force at all. But there's still collision detection, so you can still poke at the clump and maybe raise it high enough to let gravity do the work... but that isn't really using the Hammer as it is meant to be used for.

So, the question is what would I implement to make the mouse movement speed reflect its force on the Hammer object that is attached to it to break the joints?

I currently can think of two approaches to this;

  • I could write something to track the mouse velocity and then apply that to continuously add a force to the object that is following the mouse.

rigidbody.velocity = (mousePosVector - gameObj.transform.position) * speedMultiFloat;

  • Or I could write a line to say whatever this object collides with will destroy any joint regardless of how infinitely strong the break force is... which defeats the purpose of Joint Break Force.

Destroy(GetComponent <ConfigurableJoint>);

When looking at the Velocity documentation, it says not to constantly update velocity as it'll cause for odd behaviors, but for the first implementation that is ideally what I'm doing.

Comment

People who like this

0 Show 0
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

  • Sort: 
avatar image

Answer by julianwitte · Nov 14, 2016 at 07:35 AM

Looks like I am a bit late to answer, But you could keep track of a delta position for the hammer just so you know how fast user is moving it on screen. And when collision is detected, you could apply a force X * delta. That way the force you apply is related to the hammer movement speed, and you are allowed to use different break values.

Comment

People who like this

0 Show 0 · 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

Unity Answers is in Read-Only mode

Unity Answers content will be migrated to a new Community platform and we are aiming to launch a public beta on June 13. Please note, Unity Answers is now in read-only so we can prepare for the final data migration.

For more information and updates, please read our full announcement thread in the Unity Forum.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Can't change HingeJoint properties by script 1 Answer

reading forces applied to a rigidbody 1 Answer

Joint break force incorrect? 0 Answers

OnJointBreak 1 Answer

Joint Break Force Distance 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