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 aLovedHater · Nov 12, 2014 at 06:28 PM ·

Problems with Bouncing

at the moment i have 4 low walls that square of an area, and these almost hockey puck ojbects that have bouncing physics that make then infinitely slide around and bounce off the 4 square walls. I also have the script that makes them bounce (adds force to push then into bouncing) which is this #pragma strict

 function Start () 
 {
 var randomNumber = Random.Range(0,2);
 
 if( randomNumber == 0)
 {
     rigidbody.AddForce (1000f, 0, 10000f);
 }
 
 if( randomNumber == 1)
 {
     rigidbody.AddForce (-5000f, 0, 10000f);
 }
 
 if( randomNumber == 2)
 {
     rigidbody.AddForce (7000f, 0, 10000f);
 }
 
 
 }
 
 function Update () {
 
 }
 //JavaScript
 //Randomly pushes the object in a certain direction

Right now when i start the game, they bounce off the walls infinitely and work perfectly find, until after a while one by one they will hit the wall and fly way over it. i'm not sure how this happens but is there any way that i can keep my object permanently grounded without raising its mass to slow it down?

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 MrSoad · Nov 12, 2014 at 04:13 PM 0
Share

Sounds like they are reaching such a high velocity from continual adding of force that they fly off(you are using very high force values in your code).

Why don't you just have your table with a $$anonymous$$inematic rigidbody on the table surface and one on each of the table sides. Then give the table surface rigidbody a very low friction "Physical $$anonymous$$aterial" (Ice) and each side a very high bounce "Physical $$anonymous$$aterial" rather than adding forces directly. This way you can give your puck a starting push and let the physics engine take care of the rest...

Why do you want it to carry of for infinity, puck's eventually slow down even on ice...

avatar image aLovedHater · Nov 12, 2014 at 05:04 PM 0
Share

because i'm not actually making a table game like hockey or air hockey, i just meant the object i'm currently using looks like a hockey puck (placement for when i get real 3d characters). the game i'm making is a little hard to explain, but in the game there are lanes that the player runs through, and the player has to dodge the infinitely moving objects while the he runs through the lane.

avatar image MrSoad · Nov 12, 2014 at 05:58 PM 0
Share

As long as what I have suggested does not interfere with the rest of your game concept it is a better way of doing things. To keep the bouncing objects at a s$$anonymous$$dy speed you can check their current velocity magnitude, then add a little extra force in their current movement direction to top them up when needed.

You can give other objects their own physical materials which will mean they don't have to bounce and slide like the puck type movement objects do.

avatar image aLovedHater · Nov 12, 2014 at 07:15 PM 0
Share

As long as the pucks remain at a constant speed that should be perfect. thanks, i'll try it!

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

How can i make it so animation would play only when button is being pressed? 0 Answers

Unity is acting REALLY weird 0 Answers

i want to make an android app but can't set the bundle indetifier 0 Answers

UnityEngine.Input.GetMouseButton(1)) issue 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