Archived

This topic is now archived and is closed to further replies.

Shadows

Heightdefining

Recommended Posts

Hi all, I''m constructing a RPG in sort of a Tomb Raider type 3d engine. My question is if i have a square with 4 corners that differ in height and the X-Z coordinates (in a 0-1scale) where the player currently is the square. How do I in the fastest possible way calculate the Y coordinate based on where the player is in relation to the objects edges. EX: y0 y1 ______________ | | | | | | | | | x | |______________| y2 y3 x=playerpos Regards Fredrik

Share this post


Link to post
Share on other sites
Well, sorry I didn´t really read your post well. I don't know if this is the fastest way to do it:

(y0 * px * pz + y1 * (1-px) * pz + y2 * px * (1-pz) + y3 * (1-px) * (1-pz)) / 4

Where px and pz are the player coordinates.

Nick


Edited by - nickm on October 18, 2001 3:04:48 PM

Edited by - nickm on October 18, 2001 3:05:18 PM

Share this post


Link to post
Share on other sites