• 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 andrew9994 · May 16, 2014 at 01:33 PM · ballbounce

How to make an unrealistic bounce?

Hy everyone, My problem is that I want to have an unrealistic bounce between a plane and a ball, and I dont know how to script that. The problem is after the ball with the plane collides, its rotation stops and bounces a little bit along the y axis also. Here is a gif to illustrate my problem:

alt text

I noticed that when the ball with a capsule-collider colides, the bounce is almost (except the bounce along the y-axis) what i want:

alt text

I´ve tried to several functions to fix my problem (Vector3.reflect, calculate the inverse of the rotation, freeze the y position) but nothing worked perfectly. Can somebody help me out?

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

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by OfficialBAMM · May 16, 2014 at 02:47 PM

It seems like you need to freeze the Y position on the transform. Because it bounces in the air and your GIF that you want doesn't.

Comment
Add comment · Show 1 · 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 andrew9994 · May 16, 2014 at 05:27 PM 0
Share

I´ve tried freeze the y position already but the ball starts rotating several frames later, like in the first gif, and the rotation isnt reflected immediately (second gif).

avatar image
0

Answer by Loius · May 16, 2014 at 04:06 PM

You'll need to show your code if you need help fixing it. As it is I can only guess.

When you hit a wall, you need to reflect your ball's velocity around the normal of the contact. If you hit it straight on, you'll bounce exactly backwards, there should be no upwards momentum.

How's your physics material? Is the ball pulling itself up the wall?

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 andrew9994 · May 16, 2014 at 05:24 PM 0
Share

The ball moves with a constant speed also the script for the ball is:

 function Update()
 {
     rigidbody.velocity = maxSpeed * (rigidbody.velocity.normalized);
 }

That´s all. The materials: -ball: dynamic, static fricton=0.4, friction, bounce combine=average; -floor: dynamic, static fricton=0.4, friction combine=maximum, bounce combine=$$anonymous$$imum;

avatar image Loius · May 18, 2014 at 01:35 AM 0
Share

Your ball is hitting the wall and wiggling the tiniest bit, your code is saying "oh your velocity is in such-and-such a direction, you now go full speed UP!". that is why you're bouncing. you need to either prevent the bounce or set your velocity to something with a Y value that you're okay with. You might try lerping your velocity's y value between where it is and where it thinks it should be.

avatar image
0

Answer by andrew9994 · May 16, 2014 at 05:23 PM

The ball moves with a constant speed also the script for the ball is:

 function Update()
 {
    rigidbody.velocity = maxSpeed * (rigidbody.velocity.normalized);
 }

That´s all. The materials: -ball: dynamic, static fricton=0.4, friction, bounce combine=average; -floor: dynamic, static fricton=0.4, friction combine=maximum, bounce combine=minimum;

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

22 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

Related Questions

Animate a bouncing ball. 1 Answer

Block Braker with Raycasts 1 Answer

Bouncing Ball Effect 2 Answers

Bounce when hitting wall 2 Answers

How do I get a sphere to bounce of a cube at an angle 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