   height detection
  Hi, Im trying to make my avatar follow the ground in height terms. I''m aware of the concept of heightmaps, but i dont think this is any help in what im trying to do. my avatar is supposed to know (realtime or pre-calculated) the height of the ground below him .. but based on the .3ds file.for example, Blaxxun''s VRML browser throws a ray towards ground for ground height detection in realtime. I guess ill be doing sthing similar, but my question is: is this efficient enough?main question is: what is common practice for this task?thanks,drak  
  - deleted -[edited by - gammastrahler on April 14, 2002 7:37:45 PM];  I currently just take the height of the previous 10 places I have walked and average them together.  It''s a crap way of doing it but I''ve had trouble trying other ways.The ray through the plane thing I could never get to work right.I''d like to be able to set a radius around my character that will average all the spots on the circle with that radius.  That''s probably the best way I can think to do it.I''m not sure how smooth it will be though...  ;  you could check for ray-plane intersection, but that´s not enough. you also have to check for point in polygon - and that´s slow even if you use octrees or something else.  ;  Ok, but what is common practice then?This should be a first step in any game programmer i guess...;quote:Original post by mr2071  I currently just take the height of the previous 10 places I have walked and average them together.  It''s a crap way of doing it but I''ve had trouble trying other ways.The ray through the plane thing I could never get to work right.I''d like to be able to set a radius around my character that will average all the spots on the circle with that radius.  That''s probably the best way I can think to do it.I''m not sure how smooth it will be though... Hm, How do you take the heights of any of the previously 10 places you have walked on? ;  I create an array and fill them with 0''s at startup.Then in my move function, I take the height of my current x, z position.I then average the new height with all of the current heights in the array.At the end of the function, I shift every value down one and the last element in the array gets dropped.  The new height is then at the beginning of the array.  ;  >>for example, Blaxxun''s VRML browser throws a ray towards ground for ground height detection in realtime. I guess ill be doing sthing similar, but my question is: is this efficient enough?<<yes>>main question is: what is common practice for this task?<<normally ppl use heightmaps where each height sample is evenly spread out, if u use a heightmap u can easily find what 3/4 height samples surround the current position + then easily interpolate between them http://uk.geocities.com/sloppyturds/gotterdammerung.html  ;quote:Original post by zedzeek  >>for example, Blaxxun''s VRML browser throws a ray towards ground for ground height detection in realtime. I guess ill be doing sthing similar, but my question is: is this efficient enough?<<yes>>main question is: what is common practice for this task?<<normally ppl use heightmaps where each height sample is evenly spread out, if u use a heightmap u can easily find what 3/4 height samples surround the current position + then easily interpolate between them http://uk.geocities.com/sloppyturds/gotterdammerung.html Ok, the main issue I have with heightmaps, is that I plan to tell map developers to work and give me a single .3ds file for the "map". If im using any type of heightmap, i should also tell them to match that .3ds file with a heightmap that they should also produce? or should i build the heightmap based on the .3ds file, and hence not overload the map modelers.Im just looking for opinions on this issue.Thanks!;  an actual 3d model of the terrain is superior to a heightmap, as it enables more control flexibility. if u have it use it.your terrain (like everything in the game) should be devided up into areas (quadtree/bsp/octree etc) run the ray through the octree until u come to the leaf/s + do a ray->triangle test against all the tris in that leaf. if your scenegraph is well built (+ it should be) this will take next to no time to do (its not gonna be as fast as a heightmap btw but its more flexible)btw i use a proper 3d model of a terrain for gotterdammerungheightmap benifits (usually constructed from a texture)-easy-quick to make + do tests on (point under ground for example )-simple to modify    http://uk.geocities.com/sloppyturds/gotterdammerung.html  