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 shozi · Aug 22, 2015 at 03:46 PM · physicscollider

how to find direction of two rigid bodies after collide them with each other

Basically, i want to design a cricket game where i have to decide the next moving position of a ball after hitting with bat. i m confused that whether unity can move the ball after collision itself or i have to find the new direction for the ball in script...... kindly help me if anyone can

regards: Shozii

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Foulcloud · Aug 24, 2015 at 10:07 PM

Make both objects with rigidbodies and colliders. Then they will behave like real world physics and no need for coding. Rigidbodies should be set to NON-kinematic and colliders should set to NON-triggers.

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 shozi · Aug 29, 2015 at 12:28 PM 0
Share

the main thing about i m confused is to find the new direction of ball after collision. can the ball direction is handled by unity itself?????? thanks for your reply.....

avatar image Foulcloud · Aug 30, 2015 at 02:32 AM 0
Share

You can move objects around in Unity in 2 ways. You can either manually control the movement or use the built in physics. In many cases you will want to use the physics in Unity to handle the behavior of your moving objects. In these cases, ins$$anonymous$$d of moving and tracking things, you simply apply forces and let Unity handle the rest. So in your case you would apply a force to swing the bat and then the physics would take over. $$anonymous$$eep in $$anonymous$$d that everything should have a rigidbody and a collider attached. Objects with non-kinematic rigidbodies will use physics to move around and bump into things. You move these around by applying forces. Objects with kinematic rigidbodies will still bump into things but will never be affected by another object. You move these around by changing the position directly. You might also set your bat as non-kinematic and move it's position directly but you still want the ball to be set to non-kinematic. That way you don't really need any code for the ball as it will simply react to other moving objects.

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

How do I keep rigidbodies from pushing each other? 2 Answers

OnMouseDown() not firing, even though attached to collider under mouse. 1 Answer

Player Movement Goes Crazy When Hit On Side Of Moving Platform 0 Answers

Why is my trigger collider acting like a normal collider? 1 Answer

How would I change material properties of a box collider via script? 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