• 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 SohaibTheGame · May 26, 2013 at 09:36 PM · velocityspeedangleballbounce

Change bouncing angle with touching speed

Hello, i'm making a pong game, it's a natural physics bouncing based game

however, the bouncing angle of the ball on the paddle is always the same and causes a kind of a loop

my idea is:

3 colliders in paddle (Left, center, right)

the left collider bounces the ball in an angle of (-150 to -60) [random] the center collider bounces the ball in an angle of (-10 to 10) [random] the right collider bounces the ball in an angle of (60 to 150) [random]

the ball's angle changes to these no matter what was the previous angle so 3 scripts attached to 3 colliders this way;

 var b : Rigidbody;
 
 OnCollisionEnter () {
 b.rigidbody... NOW WHAT? this is where i'm getting stuck
 }

PS: i want the ball to keep the same speed

What do you suggest?

Thanks in advance xD

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 robertbu · May 27, 2013 at 05:54 AM

You don't have to do any coding for this. You just have to construct a paddle with angled sides. It would be best to do it in a 3D modeling program, but you could construct it out of three cubes parented to an empty game object. The movement script would go on the empty parent object.

alt text


angledpaddle.jpg (15.6 kB)
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

14 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

Related Questions

How to reduce bounce? 1 Answer

Ball doesn't increase speed. C# 1 Answer

My object's direction angle changes after hit a collider in a certain velocity, but also not change in different speeds. 0 Answers

Bouncing Ball Game 3 Answers

Bouncing Ball Effect 2 Answers

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