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 VIPINSIRWANI · Jul 03, 2013 at 07:52 AM · collisiondetectionrigidbodiescollision.contacts

How to add Force on Puck in Air Hockey game

I am making Air hockey game and when i am applying force on to the puck through paddle the paddle move by finger position and puck move are intersecting each other...

Comment
Add comment · Show 10
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 techboysquared1 · Jul 03, 2013 at 08:01 AM 0
Share

I'm not too sure what you are asking here. Could you please clarify your question? Are you developing this for touch screen? I would like to help you, but I can't until i know the exact problem. Also, make sure that both objects have colliders on them and if both of the colliders are mesh mark them as convex.

avatar image VIPINSIRWANI · Jul 03, 2013 at 04:21 PM 0
Share

Actually i am making air Hockey game for ipod and i am facing problem when PUC$$anonymous$$ and Paddle are colliding on that time it is detecting correctly but when i am moving paddle with my finger on that some time puck is co$$anonymous$$g inside the Paddle and i am using $$anonymous$$esh collider and i also mark it as Convex......

avatar image hoy_smallfry · Jul 03, 2013 at 05:42 PM 1
Share

Ah. Are you moving the paddle by setting the game object's transform position?

There are issues with physics if you modify the transform ins$$anonymous$$d of applying forces and torque to the object. Switching the rigid body to kinematic = true sometimes solves this.

avatar image OP_toss · Jul 03, 2013 at 06:12 PM 0
Share

Also you may need to increase the collision quality on the RigidBody to Continuous, rather than discrete. Also both need RigidBodies attached. And the Paddle needs to be kinematic.

avatar image robertbu · Jul 04, 2013 at 07:33 AM 1
Share

Your problem is common with faster moving objects. There are many ideas about how to address the problem, but not one definitive solution. In addition to the suggestions above, try reducing the Fixed Timestep. From the Edit menu, select Project Settings/Time. Reducing the Timestep increases the number of physics calculations. Another idea is to move an empty game object with your finger and attach the puck to the empty game object using a spring joint. You might also take a look at the Don't Go Through Things script in the Unity Wiki.

Show more comments

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by ZenLi · Jul 05, 2013 at 01:00 PM

I have made a similar game and solved the penetration problems...

There are a few things that cause interpenetration:

  1. Make sure your hockey paddles and pucks are the correct scale. The default cube is 1m x 1m x 1m, so scale down the pieces otherwise your forces will be extreme.

  2. Continuous collision only works for cube and sphere and capsule shapes. Mesh colliders won't work, flat cylinder shapes won't work either. So make your puck and paddles colliders out of many smaller shapes, rather than 1 cylinder (e.g. create 6 invisible spheres within your puck mesh, each sphere with a sphere collider)

  3. To interact with the physics world you must use physics functions, so instead of .transform use .rigidbody.movePosition( new Vector3 ( slideMagnitudeY, 0, -slideMagnitudeX) ) ;

  4. It is best to move an object via a spring joint or mouse joint (create an invisible 'hand' object that moves with the mouse, connect this to the paddle with a joint). That way the physics engine will be able to solve the scene in it's own way, giving you much more accurate results.

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

Answer by VIPINSIRWANI · Jul 05, 2013 at 10:30 AM

I changed Collision Setting..... and i am setting paddle position with Raycasting from camere like whera i touch via raycast transform position will be set there.. For moving Paddle i am using

else if(touch.phase == TouchPhase.Moved) { LeftFingerMoveBy = touch.position - LeftFingerPos; //dir = (touch.position - LeftFingerPos).normalized; //Direction....

             LeftFingerPos = touch.position;
             
             slideMagnitudeX = LeftFingerMoveBy.x / Screen.width;
             
             slideMagnitudeY = LeftFingerMoveBy.y / (Screen.height-200);

             }
         transform.Translate(slideMagnitudeY,0,-slideMagnitudeX);    
         
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.

Follow this Question

Answers Answers and Comments

20 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

Related Questions

Make collision work when animation is playing? c# 0 Answers

collision detection not working? 1 Answer

Collision Problem - Floor Button & Character Controller 1 Answer

Find axis of collision 0 Answers

Fixed Joint Configuration 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