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 xikky · Feb 21, 2013 at 06:34 PM · collisionforcelimit

How can I limit collision force?

I need to limit a ball's bounce force when it hits other colliders.

I already limited rigidbody.velocity using Vector3.ClampMagnitude, but this does only decrease the bounce force speed at different values of hitting force. It does not give a limit to the ball's speed after hit which the ball should never exceed due to bounce force.

I need this because I have some kind of a pin pong game and I don't want the ball to exceed a specific speed limit because of the bounce force on hit. Because if it does so, physics gets weird.

So what I have in mind to solve this problem

 function OnTriggerEnter (item:Collider) {
     print("y");
     if(item.gameObject.tag == "softpillow") {
         
         rigidbody.velocity = Vector3.ClampMagnitude(rigidbody.velocity, maxSpeed);
 //this does not limit the ball's speed on hit but only decreases it.
 //I need to limit ball speed here.
     }
     
 }

How can I limit the collision force so that I can limit the speed at which the ball bounces off?

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 robertbu · Feb 21, 2013 at 06:39 PM 0
Share

Have you setup your physic material for both your softpillow and your ball for the bounce you want? Have you played with the mass of the ball?

avatar image xikky · Feb 21, 2013 at 07:15 PM 0
Share

yes I did but that does not give an absolute limit. If you observe well, the ball's speed after collision is relevant to the force used when hitting. A higher force will result into sending the ball with a higher speed. Limiting the rigidbody's velocity or bounce from physics material will only decrease the speed, thus a much greater force will be required to go overspeed again. But I need to absolutely limit the speed, so the limit is never exceeded even if a huge force is applied when hitting.

1 Reply

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

Answer by Posly · Feb 21, 2013 at 07:20 PM

I'm not too experienced with rigidbodies but I think something like this would work: var speed : float;

 var maxSpeed : float;
 
 function Update ()
 {
 if(speed > maxSpeed) {
 speed = maxSpeed;
 }
 }

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 xikky · Feb 21, 2013 at 07:29 PM 0
Share

I think that is the same as

 rigidbody.velocity = Vector3.Clamp$$anonymous$$agnitude(rigidbody.velocity, maxSpeed);

but I'll give it a try.

avatar image xikky · Feb 21, 2013 at 07:51 PM 0
Share

Thanks! works perfect :)

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

10 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

Related Questions

Character Controller meets Rigidbody 1 Answer

Finding collision force not working in certain situations. 0 Answers

Calculate Force of WheelCollider hitting the ground? 1 Answer

Click and drag object, apply force to other objects 1 Answer

is there a way to limit the amount of AddForce? 2 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