On Sun, Jan 12, 2003 at 11:39:45PM +0100, Bertrand Lamy wrote: > > In version 0.2.1, I'm trying to modify lesson-104.py to track the > > actual height of the land, but the camera seems to always stay at the > > same y position. Here's a copy of my modified code. > > land.get_height(anything) always returns 1.09803926945. > > As Jack said, the function get_height is waiting for integers cause this function >actually returns only the heights given to create the map (ie the height values of >the array) > > so you have 2 solutions: > > transform float to interger: > land.get_height(int(camera.x), int(camera.z)) > > or read the real height, the one that is interpolated between the values of the >array. To obtain this real height you can use raypicking or use one of the new >function of the land (I think it is implemented in 0.2.1 else it will be available >soon ;) > > land.get_true_height(float_x, float_z) > > (this function return the graphical height at 1 point of the land ie the height you >can see on your screen. I means as you know the land is morphing to have more >accuracy near the camera and less far away so the height you get for 1 point can be >modified by the camera position!)
land.get_true_height seems to work perfectly! land.get_height with integer arguments scaled by scale_factor worked as well, but it was jumpy as you'd expect. My first problem appears to be solved! Thanks! -- Sean Lynch http://sean.lynch.tv/
msg00005/pgp00000.pgp
Description: PGP signature