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 /
  • Help Room /
avatar image
0
Question by NadhmiPrince · Nov 18, 2015 at 07:20 PM · physicsbouncephysicmaterial

Ball Bounce And Rotating Walls

Hi there,

I started a new project in Unity5, it's a game about a bouncing ball and the player have to use the left and right keys to rotate the walls (this picture would help) alt text

Everything was fine, the ball bounces well, but when I rotate the walls and the ball hit it, it goes up or something but it doesn't bounce as i want it to.

Let me explain, when the ball hit the floor (or the wall) and I rotate the wall counter-clockwise I want the ball to bounce 90° (well not exactly 90°) off the surface no matter what direction is the wall alt text

Hope I made you understand my situation and hopefully you're gonna help me here.

pic2.png (23.2 kB)
pic3.png (79.2 kB)
Comment
Add comment · Show 4
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 _Game_Dev_Dude_ · Nov 18, 2015 at 07:49 PM 1
Share

Are you using unity physics to move the ball or you're own math?

A very simple and easy way to get "boucing" is to make the velocity of the object the negative of itself (0 - currentVelocity). But this would only be viable if you are keeping track of the ball's velocity yourself.

If you are using unity physics, set the gravity check box to off, set the drag to 0 and then just give it an initial impulse and it should do exactly what you are trying to achieve.

avatar image NadhmiPrince _Game_Dev_Dude_ · Nov 19, 2015 at 05:35 PM 0
Share

sorry for the late reply. Thanks, you helped me achieve what I was looking for.

avatar image Soos621 · Nov 18, 2015 at 08:21 PM 0
Share

You can use Vector3.Reflect to find out which direction you want the ball to move in and either directly set the velocity or addforce in the direction you want the ball to move. Do you have physics materials applied to the colliders? If not try setting up a physics material for the ball and the walls and play around with the bounce settings, this may help you achieve a more realistic "bounce" effect.

avatar image Soos621 Soos621 · Nov 18, 2015 at 08:22 PM 0
Share

sorry forgot the link to the scripting API http://docs.unity3d.com/ScriptReference/Vector3.Reflect.html http://docs.unity3d.com/ScriptReference/Rigidbody.html

0 Replies

· Add your reply
  • Sort: 

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

43 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Why Does Bounciness Affects Rigidbody Velocity? (SOLVED) 0 Answers

How do I get an object to behave like a balloon? 0 Answers

Objects wont stop bouncing if they fall. 0 Answers

What's the best method for pinball-type bumper physics (3D)? 1 Answer

When putting up the friction it doesn't change anything. 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