• 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 /
  • Help Room /
avatar image
Question by Jaqif · Oct 09, 2015 at 02:15 PM · collision3danglebounce

How can i force collision angle

Here is the thing 1/ a ball with a rigidbody 2/ A sphere 3/ in a 3D tunnel with a wall at the end, top, bottom, left and right 4/ a paddle

The paddle launch the ball forward, hit the wall and come back (z axis)

The sphere is in the middle of the tunnel.

When the ball is hitting the sphere using physics engine, sometimes (depending on the contact point) the bounce has angle that I want to limit because the bounce direction (reflected vector) doesn't match what i want. For example I don't want the ball to get an angle that goes up and down (or left and right) with very low angle ( ex 5 degree). But backward and forward is allowed (hitting the end wall or the sphere and coming back is allowed, even with a small angle) So I want to define series of boundaries for this angle and if the bounce angle is not in the boundary I force the angle to the nearest boundary. I've found lot of infos about vector reflection, vector angle.. but I don't know how the force the right vector reflected regarding an angle I want.

Thanks for your help

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

· Add your reply
  • Sort: 
avatar image

Answer by Statement · Oct 10, 2015 at 12:24 AM

I guess a first step would be to properly define desired outcomes for different scenarios. It's a bit tricky to think about. Perhaps you could as a first test do something really crude to get a sense for how it would work out, like, if the Z velocity is below a certain treshold, gradually increase velocity until it has enough speed to get out of the "boring Y ping pong zone". It would of course not be physically correct and would behave a little like a remote controlled unit but if you tweak the speed in which it adjust Z velocity you may get away with a simple solution.

Comment
Jaqif

People who like this

1 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 Jaqif · Oct 12, 2015 at 06:59 AM 0
Share

Yeah @Statement,

thanks a lot, I didn't think it this way. I've just test to force z velocity to keep it in a certain range on collision exit event and it works well. So no need to handle complex solution with angle. Thanks a lot for your help.

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.

Update about the future of Unity Answers

Unity Answers content will be migrated to a new Community platform and we are aiming to launch a public beta later in June. Please note, we are aiming to set Unity Answers to read-only mode on the 31st of May in order to prepare for the final data migration.

For more information, please read our full announcement.

Follow this Question

Answers Answers and Comments

34 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

Related Questions

Ball won't stop bouncing 1 Answer

Wall Jump with Jump Delay 0 Answers

Collisions only working in the editor but not in the build 0 Answers

Find and Destroy Untouched Objects to Floor 1 Answer

How can I Wall Jump with a Delay 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