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 NicolusBuck · May 30, 2015 at 05:11 PM · collisionphysicsrigidbody

Ping Pong bat is not detecting the collision with the wall

Hi everybody ,

I am a n00b . I am learning Unity from last couple of days . I want to make one simple ping pong game . Idea is simple . The game has a Sphere as a ball , a plane as ground , 2 rectangle as bats and 4 rectangles as wall . Look at the image alt text.

It is 2 player game . One player will use 'W' and 'S' key and another player will use 'Up Arrow' and 'Down Arrow' on the keyboard to move the bat up and down .

But I have a problem here . If a player moves the bat very up or very down , the bat does not detect the collision with the wall . It just goes through the wall . Look at the image . alt text .

The bat and the wall has Box Collider , but still it gives the problem . So what to do so that the bat detects the collision with the wall .

So please let me know where I went wrong . I am a beginner , your help will definitely help me in future .

Thanks :)

unity-1.png (32.5 kB)
unity-2.png (33.7 kB)
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 erebel55 · Jun 04, 2015 at 01:06 PM

You will need to either put a rigidbody on the paddle's so that it is controlled by physics http://docs.unity3d.com/ScriptReference/Rigidbody.html

Or code a collision response (the detection is probably already working)

Research OnCollisionEnter or OnTriggerEnter to response to the collision detection. On the response you will want to stop the paddle from moving in that direction.

http://docs.unity3d.com/ScriptReference/MonoBehaviour.OnCollisionEnter.html http://docs.unity3d.com/ScriptReference/Collider.OnTriggerEnter.html

You could also just limit the movement of the paddles in the appropriate axis, so that you don't even have to deal with collisions with the wall.

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Nav Mesh Agent won't fall off the platform? 1 Answer

Stop rigidbodies from bouncing 3 Answers

Tossing an object with the correct force at any distance from another so that it collides with the other 1 Answer

Camera gets flung off of the map when the player collides with certain objects. 0 Answers

Ignore collision with self? 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