473,406 Members | 2,847 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

HELP / ADVICE: Would this be suitable to perform a basic collision?

Hello all,

Well, we've gotten to it: the real meaty area of my Air Hockey game..

Any help or suggestions for the following would be much appreciated.

In plain terms:
My paddle needs to be able to strike the puck and move in the direction
opposite to which it was struck (a simple collision, basically!)

In C# terms:
My puck is now a GraphicsPath consisting of a number of points around the
circumference. Every time the game is redrawn, i check if any of those
points on are visible inside the paddle region. If so, a collision has
occured! This seems to be working fine, by the way!

Now to the problem at hand... the puck should move in the direction opposite
to which it was struck (as a said before, a simple collision). How would i
go about implementing this in C#?

This was what i was thinking:

Draw a line tangeant to the point of intersection (the point at which the
collision between the puck and paddle is first detected). The puck should
then move in the direction right angles to that line tangeant. Am i right in
saying this, or is there an easier method?

Click te link below to see a very poorly drawn diagram of what i mean. This
is probably delving more into the Maths area than anything but any help
would be much appreciated, as i haven't even explored the maths / angles
side of C# yet.

http://homepage.eircom.net/~basquill...ycollision.jpg

Thanks again all.

Brian
Nov 16 '05 #1
4 1739
I might be missing something here, but doesn't the right angle to the tangent
assume that the point receiving the collision is stationary. In your
diagram, if the blue point has a velocity vector, then I wouldn't expect the
resulting vector of the red point to be the negative of it's current vector.
Instead, I would think that an addition of the two vectors would be in order.

At least, that's the way it seems to me. Reality may be quite different. ;)

Bruce Johnson [C# MVP]
http://www.objectsharp.com/blogs/bruce

"Brian Basquille" wrote:
Hello all,

Well, we've gotten to it: the real meaty area of my Air Hockey game..

Any help or suggestions for the following would be much appreciated.

In plain terms:
My paddle needs to be able to strike the puck and move in the direction
opposite to which it was struck (a simple collision, basically!)

In C# terms:
My puck is now a GraphicsPath consisting of a number of points around the
circumference. Every time the game is redrawn, i check if any of those
points on are visible inside the paddle region. If so, a collision has
occured! This seems to be working fine, by the way!

Now to the problem at hand... the puck should move in the direction opposite
to which it was struck (as a said before, a simple collision). How would i
go about implementing this in C#?

This was what i was thinking:

Draw a line tangeant to the point of intersection (the point at which the
collision between the puck and paddle is first detected). The puck should
then move in the direction right angles to that line tangeant. Am i right in
saying this, or is there an easier method?

Click te link below to see a very poorly drawn diagram of what i mean. This
is probably delving more into the Maths area than anything but any help
would be much appreciated, as i haven't even explored the maths / angles
side of C# yet.

http://homepage.eircom.net/~basquill...ycollision.jpg

Thanks again all.

Brian

Nov 16 '05 #2
Thanks for the feedback Bruce.

I'm afraid the addition of vectors (etc.) is an area in C# i haven't got
much knowledge about.

Any links / examples to help me think this through.

And if possible, please tell me more about your approach.
"Bruce Johnson [C# MVP]" <br***@spammenot.objectsharp.com> wrote in message
news:5E**********************************@microsof t.com...
I might be missing something here, but doesn't the right angle to the
tangent
assume that the point receiving the collision is stationary. In your
diagram, if the blue point has a velocity vector, then I wouldn't expect
the
resulting vector of the red point to be the negative of it's current
vector.
Instead, I would think that an addition of the two vectors would be in
order.

At least, that's the way it seems to me. Reality may be quite different.
;)

Bruce Johnson [C# MVP]
http://www.objectsharp.com/blogs/bruce

"Brian Basquille" wrote:
Hello all,

Well, we've gotten to it: the real meaty area of my Air Hockey game..

Any help or suggestions for the following would be much appreciated.

In plain terms:
My paddle needs to be able to strike the puck and move in the direction
opposite to which it was struck (a simple collision, basically!)

In C# terms:
My puck is now a GraphicsPath consisting of a number of points around the
circumference. Every time the game is redrawn, i check if any of those
points on are visible inside the paddle region. If so, a collision has
occured! This seems to be working fine, by the way!

Now to the problem at hand... the puck should move in the direction
opposite
to which it was struck (as a said before, a simple collision). How would
i
go about implementing this in C#?

This was what i was thinking:

Draw a line tangeant to the point of intersection (the point at which the
collision between the puck and paddle is first detected). The puck should
then move in the direction right angles to that line tangeant. Am i right
in
saying this, or is there an easier method?

Click te link below to see a very poorly drawn diagram of what i mean.
This
is probably delving more into the Maths area than anything but any help
would be much appreciated, as i haven't even explored the maths / angles
side of C# yet.

http://homepage.eircom.net/~basquill...ycollision.jpg

Thanks again all.

Brian

Nov 16 '05 #3
Just so that you know, my knowledge of this is going back about 20+ years to
when I was getting a mathematics degree. If memory serves, there is a right
angle relationship between the momentum of an object before collision and the
resulting momentum of both objects after collision. But I don't think it's
the right angle of the tangent, but that, due to conservation of momentum,
the velocity vectors of the objects after collision form a right angle
triangle with the original momentum vector as the hypotenuse. You've now
exhausted my memory.

I did some quick research, and it seems like the following link contains a
discussion on the topic that you might find useful

http://www.idevgames.com/forum/archi...hp/t-2963.html

Hope this helps.

Bruce Johnson [C# MVP]
http://www.objectsharp.com/blogs/bruce

"Brian Basquille" wrote:
Thanks for the feedback Bruce.

I'm afraid the addition of vectors (etc.) is an area in C# i haven't got
much knowledge about.

Any links / examples to help me think this through.

And if possible, please tell me more about your approach.
"Bruce Johnson [C# MVP]" <br***@spammenot.objectsharp.com> wrote in message
news:5E**********************************@microsof t.com...
I might be missing something here, but doesn't the right angle to the
tangent
assume that the point receiving the collision is stationary. In your
diagram, if the blue point has a velocity vector, then I wouldn't expect
the
resulting vector of the red point to be the negative of it's current
vector.
Instead, I would think that an addition of the two vectors would be in
order.

At least, that's the way it seems to me. Reality may be quite different.
;)

Bruce Johnson [C# MVP]
http://www.objectsharp.com/blogs/bruce

"Brian Basquille" wrote:
Hello all,

Well, we've gotten to it: the real meaty area of my Air Hockey game..

Any help or suggestions for the following would be much appreciated.

In plain terms:
My paddle needs to be able to strike the puck and move in the direction
opposite to which it was struck (a simple collision, basically!)

In C# terms:
My puck is now a GraphicsPath consisting of a number of points around the
circumference. Every time the game is redrawn, i check if any of those
points on are visible inside the paddle region. If so, a collision has
occured! This seems to be working fine, by the way!

Now to the problem at hand... the puck should move in the direction
opposite
to which it was struck (as a said before, a simple collision). How would
i
go about implementing this in C#?

This was what i was thinking:

Draw a line tangeant to the point of intersection (the point at which the
collision between the puck and paddle is first detected). The puck should
then move in the direction right angles to that line tangeant. Am i right
in
saying this, or is there an easier method?

Click te link below to see a very poorly drawn diagram of what i mean.
This
is probably delving more into the Maths area than anything but any help
would be much appreciated, as i haven't even explored the maths / angles
side of C# yet.

http://homepage.eircom.net/~basquill...ycollision.jpg

Thanks again all.

Brian


Nov 16 '05 #4
Much appreciated Bruce!

And thank for the link..... very very useful!!!

"Bruce Johnson [C# MVP]" <br***@spammenot.objectsharp.com> wrote in message
news:61**********************************@microsof t.com...
Just so that you know, my knowledge of this is going back about 20+ years
to
when I was getting a mathematics degree. If memory serves, there is a
right
angle relationship between the momentum of an object before collision and
the
resulting momentum of both objects after collision. But I don't think
it's
the right angle of the tangent, but that, due to conservation of momentum,
the velocity vectors of the objects after collision form a right angle
triangle with the original momentum vector as the hypotenuse. You've now
exhausted my memory.

I did some quick research, and it seems like the following link contains a
discussion on the topic that you might find useful

http://www.idevgames.com/forum/archi...hp/t-2963.html

Hope this helps.

Bruce Johnson [C# MVP]
http://www.objectsharp.com/blogs/bruce

"Brian Basquille" wrote:
Thanks for the feedback Bruce.

I'm afraid the addition of vectors (etc.) is an area in C# i haven't got
much knowledge about.

Any links / examples to help me think this through.

And if possible, please tell me more about your approach.
"Bruce Johnson [C# MVP]" <br***@spammenot.objectsharp.com> wrote in
message
news:5E**********************************@microsof t.com...
>I might be missing something here, but doesn't the right angle to the
>tangent
> assume that the point receiving the collision is stationary. In your
> diagram, if the blue point has a velocity vector, then I wouldn't
> expect
> the
> resulting vector of the red point to be the negative of it's current
> vector.
> Instead, I would think that an addition of the two vectors would be in
> order.
>
> At least, that's the way it seems to me. Reality may be quite
> different.
> ;)
>
> Bruce Johnson [C# MVP]
> http://www.objectsharp.com/blogs/bruce
>
> "Brian Basquille" wrote:
>
>> Hello all,
>>
>> Well, we've gotten to it: the real meaty area of my Air Hockey game..
>>
>> Any help or suggestions for the following would be much appreciated.
>>
>> In plain terms:
>> My paddle needs to be able to strike the puck and move in the
>> direction
>> opposite to which it was struck (a simple collision, basically!)
>>
>> In C# terms:
>> My puck is now a GraphicsPath consisting of a number of points around
>> the
>> circumference. Every time the game is redrawn, i check if any of those
>> points on are visible inside the paddle region. If so, a collision has
>> occured! This seems to be working fine, by the way!
>>
>> Now to the problem at hand... the puck should move in the direction
>> opposite
>> to which it was struck (as a said before, a simple collision). How
>> would
>> i
>> go about implementing this in C#?
>>
>> This was what i was thinking:
>>
>> Draw a line tangeant to the point of intersection (the point at which
>> the
>> collision between the puck and paddle is first detected). The puck
>> should
>> then move in the direction right angles to that line tangeant. Am i
>> right
>> in
>> saying this, or is there an easier method?
>>
>> Click te link below to see a very poorly drawn diagram of what i mean.
>> This
>> is probably delving more into the Maths area than anything but any
>> help
>> would be much appreciated, as i haven't even explored the maths /
>> angles
>> side of C# yet.
>>
>> http://homepage.eircom.net/~basquill...ycollision.jpg
>>
>> Thanks again all.
>>
>> Brian
>>
>>
>>


Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Jacek Generowicz | last post by:
Where can I find concise, clear documentation describing what one has to do in order to enable Python's internal help to be able to provide descriptions of Python keywords ? I am in a situation...
4
by: suri | last post by:
CURRICULAM VITAE Suresh Babu.M mandalapu_s@yahoo.com Mobile: 9848444135. Objective:
22
by: Rafia Tapia | last post by:
Hi all This is what I have in mind and I will appreciate any suggestions. I am trying to create a xml help system for my application. The schema of the xml file will be <helpsystem> <help...
2
by: prash | last post by:
Hi everybody, I would like to request all the members to help me find the source code for the following : 1.C program for error detecting code: CRC-CCITT and CRC -32. 2.c Program for...
2
by: computerboy | last post by:
I am writing this program that takes a number gives it a hash humber and then put the orginal number in the array spot. ex. Enter a number: 32 Hash value is 5 so 32 is placed in the 5th spot of...
53
by: Hexman | last post by:
Hello All, I'd like your comments on the code below. The sub does exactly what I want it to do but I don't feel that it is solid as all. It seems like I'm using some VB6 code, .Net2003 code,...
22
by: Ramon F Herrera | last post by:
My goal is to study (in the RMS sense) and familiarize myself with some OSS code, until I reach the point at which I can make non-trivial modifications to it. The class of applications I have in...
11
by: tracy | last post by:
Hi, I really need help. I run this script and error message appeal as below: drop trigger log_errors_trig; drop trigger log_errors_trig ERROR at line 1: ORA04080: trigger 'LOG_ERRORS-TRIG'...
53
by: souporpower | last post by:
Hello All I am trying to activate a link using Jquery. Here is my code; <html> <head> <script type="text/javascript" src="../../resources/js/ jquery-1.2.6.js"</script> <script...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.