469,271 Members | 1,447 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,271 developers. It's quick & easy.

Some Region.Intersect questions / problems...

Greetings all,

I wrote a message regarding hit-lines here a couple of days back
saying:

"Anyone got links to some examples of using Region and/or
Region.Intersect in a graphical / gaming enviroment?

Am investigating into using it for hit-lines in my game."

I apologise for not writing this after the message but i didn't think
a message a few days old would be noticed with a new reply.

I got a reply from Dmitriy Lapshin:

"If your game is 2D, or at least you hit-test 2D projections, you can
create
regions for two entities you are going to check for a collision and
then
intersect these regions. Then check whether the resultant region is
non-empty and if it is, you've got the collision, otherwise there was
no
collision."

Some great advice here from Dmitriy.

Some brief questions though.. my hit-lines are a series of graphical
lines. I add these lines (AddLine()) to a GraphicsPath object and i
then make this a region. Is this correct so far? Should i use the
CloseFigure() method or anything? I then my convert to a rectangle and
intersect the region and rectangle. Does this seem plausible?

Also, my puck is constantly moving over the table but i want to check
if the puck has moved outside it. This is proving quite the
difficulty... anyone got any suggestions how exactly to draw and
intersect the region in this situation?

Many apologies for not replying this to my original post, but i've
been stuck in a rut with these hit-lines for a couple of weeks now.

Brian
Nov 16 '05 #1
1 2227
Sorry, forgot to mention this in the original message:

In Dmitiriy's original reply, he said..

"..you can create regions for two entities you are going to check for
a collision and
then intersect these regions. Then check whether the resultant region
is non-empty and if it is, you've got the collision, otherwise there
was no collision."

However, the return type for Region.Intersect is void so how would i go
about checking a resultant region?

Many thanks all!

Brian

Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Senne Vaeyens | last post: by
4 posts views Thread by Brian Basquille | last post: by
2 posts views Thread by Brian Basquille | last post: by
3 posts views Thread by Martin | last post: by
reply views Thread by Peter Duniho | last post: by
1 post views Thread by CARIGAR | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.