I'm wondering if there isn't a better way to position a newly created model on terrain. I am currently using this method, which doesn't always seem to work correctly even when the models origins are in the right place.
I had the weirdest problem using the c_trace function for an elevation radar in that only every other trace gave a valid result (hit) and every other gave no result (null). It was very predictable. I never solved or figured out the underlaying cause but instead used a workaround by always doing two traces in a row and only using the one with a result. I did that by doing something like this:
c_trace(); if(result) { // do ent_create or whatever } else { c_trace(); // again // then do whatever ... }
I think it might be a bug in c_trace but I never filed a bug rep so I can't say for sure.
Hope this helps to solve your troubles too, cheers, tindust
Re: placing models on the terrain
[Re: tindust]
#170541 12/01/0723:5212/01/0723:52
Oh, if you meant the z of a specific terrain vertex that could be done with the vec_for_vertex but one would have to know the vertex number then. (I suppose that number could also be found with a c_trace ...).
Re: placing models on the terrain
[Re: tindust]
#170544 12/02/0700:3912/02/0700:39
Well, I think we are talking about two different things here. 1/ If you want to find the coordinates of a vertex, well, they are far apart no matter what method one applies to find them. 2/ Finding a point of a trace hit I suppose will be the point interpolated inbetween vertices of the polygonized terrain if that is chosen for the trace. I have a hard time to see how a trace hit on the bounding box of the terrain would be more accurate. Maybe i misunderstand. Could you elaborate a bit ...