OFF Topic Iso Mouse

Hi Guys
Sorry for an off topic question but i need help with some maths and
i sure some of you have a better maths background than me, I am writing an
isometric game (not tile based) and i translate my screen mouse to isometric
no problem as i am easily working out the x and z cords on the floor of my
isometric room with,

ClickX = (int)((2*Mousey-Mousex)/2);
ClickZ = (int)Mousex+ClickX;

then i check to see if its within my room box with a simple box check and it
works a treat, but when the mouse is beyond the bounds of the room floor
area shown in blue it could be on a wall so i need to work out the
mouse position on the vertical walls green and red.

so if anyone can help me i would be grateful,

Trish
-------------- next part --------------
A non-text attachment was scrubbed…
Name: Isoroom.jpg
Type: image/jpeg
Size: 7549 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20070426/ba4721ed/attachment.jpg

I myself haven’t worked with iso before but you know a great place to ask
general game programming questions is the gameprogrammer.com mailing list,
you should go check it out (:_____

From: sdl-bounces@lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On
Behalf Of Patricia Curtis
Sent: Wednesday, April 25, 2007 6:28 PM
To: sdl at lists.libsdl.org
Subject: [SDL] OFF Topic Iso Mouse

Hi Guys

     Sorry for an off topic question but i need help with some maths and

i sure some of you have a better maths background than me, I am writing an
isometric game (not tile based) and i translate my screen mouse to isometric
no problem as i am easily working out the x and z cords on the floor of my
isometric room with,

ClickX = (int)((2*Mousey-Mousex)/2);

ClickZ = (int)Mousex+ClickX;

then i check to see if its within my room box with a simple box check and it
works a treat, but when the mouse is beyond the bounds of the room floor
area shown in blue it could be on a wall so i need to work out the mouse
position on the vertical walls green and red.

so if anyone can help me i would be grateful,

Trish

Hi,

I think you have swapped your iso coordinates. According to the picture you
sent, they should be:

cX = mX/2 + mY
cZ = mY - mX/2 = cX - mX

where cX, cZ are the floor iso coordinates and mX, mY the mouse coordinates.

For the walls, we could use a reference frame as shown in the attached
picture. You can use these expressions when you know you are out of the
floor, as you said:

cX = -mX
cY = mY - mX/2

As the cY coordinates start from the origin, you have to subtract a value in
order to have cY=0 at the bottom of the wall:

value = ( floor_Z_length + floor_X_lenght) / 2

so the correct Y coordinate of the left wall would be

cY = mY - mX/2 - value

For the right wall, it would be the same, but using Y and Z.

Hope that helps,

Alberto

El Jueves, 26 de Abril de 2007 03:27, Patricia Curtis escribi?:

Hi Guys
Sorry for an off topic question but i need help with some maths
and i sure some of you have a better maths background than me, I am writing
an isometric game (not tile based) and i translate mY screen mouse to
isometric no problem as i am easily working out the x and z cords on the
floor of mY isometric room with,

ClickX = (int)((2*Mousey-Mousex)/2);
ClickZ = (int)Mousex+ClickX;

then i check to see if its within mY room box with a simple box check and
it works a treat, but when the mouse is beyond the bounds of the room floor
area shown in blue it could be on a wall so i need to work out the mouse
position on the vertical walls green and red.

so if anyone can help me i would be grateful,

Trish
-------------- next part --------------
A non-text attachment was scrubbed…
Name: axis.png
Type: image/png
Size: 4421 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20070426/44349572/attachment.png