• 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 Meuktwo · Mar 24, 2017 at 07:51 PM · c#rigidbodyiskinematic

Pong: Paddle rigidbody, handling collision

Hi, I'm new to unity. I have a question about how to deal with the paddle movement. I want it so that the ball bounces off the paddle without moving the paddle and the paddle not flying off when it hits the edges. I've read that i should set iskinematic to true, but then i cant move it using addforce... What i currently have is a paddle with really high mass such that the ball doesn't push it. I've tried making iskinematic true for onCollisionEnter and false for onCollisionExit when colliding with a wall but it still moves and turns slightly... Ideally I'd like it to remain straight and just bounce off the wall

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 phxvyper · Mar 24, 2017 at 10:19 PM

Enable isKinematic, and move the Rigidbody using Velocity rather than Force.

When the ball collides with the paddle, have your ball's script get the normal for the collision and set its velocity in that direction.

Typically you'd only keep isKinematic off if you want realistic movement and physics (like world props). But something like Pong shouldnt require any physics simulation.

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

Collider/Rigidbody issue.Camera shaking! 3 Answers

Jittery world around stationary character 1 Answer

Strange/Buggy code behavier 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges