Page 1 of 1

Reputation:

# How to get direction after collision of an image by another fix image

Posted 15 November 2010 - 11:21 PM

Hi All

I am making a game in which ball collid with another fix object ball only first ball should bounce back , i have only speed of the ball, how can i get the direction of the ball,plz tell me what matter required to get the direction of the ball ,how ball can be bounce back after collision with a fix body...
Is This A Good Question/Topic? 0

## Replies To: How to get direction after collision of an image by another fix image

### #2 modi123_1

• Suitor #2

Reputation: 14239
• Posts: 57,130
• Joined: 12-June 08

## Re: How to get direction after collision of an image by another fix image

Posted 15 November 2010 - 11:33 PM

Easily it could be done with making it a right angle to the hit. So flip an X or Y (depending on the side it was hit) and keep the motion going that way. Give or take due to momentum loss.

This post has been edited by modi123_1: 15 November 2010 - 11:33 PM

Was This Post Helpful? 0

Reputation:

## Re: How to get direction after collision of an image by another fix image

Posted 16 November 2010 - 01:09 AM

Thanks for reply,

can u give me some code to do this , i have only the speed of the ball......
Was This Post Helpful? 0

### #4 modi123_1

• Suitor #2

Reputation: 14239
• Posts: 57,130
• Joined: 12-June 08

## Re: How to get direction after collision of an image by another fix image

Posted 16 November 2010 - 09:14 AM

You don't have the direction the ball is moving?

I can't give you the code because I don't know how you wrote your ball's movement...
Was This Post Helpful? 0

Page 1 of 1

 .related ul { list-style-type: circle; font-size: 12px; font-weight: bold; } .related li { margin-bottom: 5px; background-position: left 7px !important; margin-left: -35px; } .related h2 { font-size: 18px; font-weight: bold; } .related a { color: blue; }