Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Game programming question - 3D to 2D formula ?
Message
 
 
General information
Forum:
Visual Basic
Category:
Other
Miscellaneous
Thread ID:
00814964
Message ID:
00815745
Views:
15
Joe,

Thanks for your response. I see where you're going with ball size and I understand the concept but I'm not sure how this would work with the ball placement in a 3 dimensional room. In other words imagine a room that is represented on the screen (two dimensional obviously) by a square inside a larger square with four diagonal lines connecting the corners. In that picture, the viewer is located behind the back wall (which is transparent) and can see the other 3 walls as well as the floor and ceiling of the room.

In order to make a ball bounce off all the walls (including the floor and ceiling) it would seem that you would not be able to use the pixel X and Y values as equal to the ball X and Y values since these would be different based on the Z value of the ball. Does that make sense or am I missing something obvious here??

Thanks!
-Kevin


>>> You Wrote:

Kevin,
Use x and y as they are. Decide how big your ball is when it is as close as possible to the user iDiaNear. Then decide how big the ball is when it is farthest away iDiaFar. Use Z as a multiplier for the ball diameter...

eg if;
max value for your Z is 480 [zmax]. ' Max room depth
iDiaFar is 22. ' Diameter of the ball at the farthest point
iDiaNear is 64. ' Diameter of the ball at the Nearest point
Z = 240 then ' Current Z of th ball
iBallDia = 38 ' Current diameter of the ball

iBallDia = (iDiaNear - (iDiaFar*2+1)) / (z/zmax) ' Your diameter formula
' ** iDiaFar*2+1 allows for a size freedom.

The meat of this is to ignore z regarding placement. Z only regards perception. Use the formula above and you are all set. This all assumes your user cannot enter the room. If he can you need to figure his Z and subtract it from Z so perceptions are maintained. ;}

Lastly, DirectX will handle this for you quite well, I tech edited DirectX 8 and Visual Basic Developement by Keith Sink. SAMS publishing 0-672-32225-0

Hope this helps,
Joe
Kevin Scott
kehvn@carolina.rr.com


Hey! It's not my fault. It's some General named Protection!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform