• Advertisement
Sign in to follow this  

How to constrain motion to vector length over a heigtmap?

This topic is 3766 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm pretty new to 3d, so please bear with me. I am moving a character over heightmap. How do I determine the intersection of the motion vector with the heightmap without precalculating the vertices? I believe a slope approximation will work so long as the vector is small enough, as the heightmap is perlinNoise generated. Should I translate the vector to 2d and increase theta till there is a close enough approximation to the heightmap values? Or is there a more efficient method than a recursive function? Here is a basic example, notice that the velocity is not affected by the change in elevation. That is what I need to work out. http://www.geocities.com/webwizardsways/flash/prerender.html

Share this post


Link to post
Share on other sites
Advertisement
Edit: I think I completely misinterpreted you first time. Just to be sure - you're talking about isometrically projecting the motion vector onto the height-map for the purpose of computing the slope, rather than determining the point of intersection of the height-map and a vector, right?

You can compute the slope of the heightmap using something akin to the directional derivative:

1. Project the motion vector to y=0 and normalise it.
2. Determine which patch of height-map the actor is above and compute the local gradients in the x- and z-directions; store this as another vector. Equivalently, compute the vector gradient with respect to y.
3. Multiply these two vectors pointwise.

The result will contain the resistance to motion in each direction, with 1 being sheer uphill, 0 level, -1 sheer downhill. Sum the components (or just take the dot-product in (3)) for the overall slope.

Admiral

Share this post


Link to post
Share on other sites
Forgive my ignorance, but I don't belive this is isometric, as all values are passed through the basic focal legnth formula for scaling. As I understand, isomotry doesn't factor in scaling?

Is your method more efficient than just increasing theta till the vector endpoint is within tolerance of the heightmap values?

Share this post


Link to post
Share on other sites
Quote:
Original post by JerryScript
Forgive my ignorance, but I don't belive this is isometric, as all values are passed through the basic focal legnth formula for scaling. As I understand, isomotry doesn't factor in scaling?
It's not ignorance and there's no forgiveness necessary, but I'm afraid I don't understand. Where does focal length come into play? By isometric I meant an effective rotation and translation to fit the 'motion vector' onto the height-map surface as a tangent, without any scaling. This only works if the motion vector was already normalised. If this isn't the case then I'm afraid I'll have to ask for further explanation.

Quote:
Is your method more efficient than just increasing theta till the vector endpoint is within tolerance of the heightmap values?

Almost certainly. Poking around with a couple of vectors and evaluating a dot-product is never a performance concern. Relying on an iteration to terminate isn't necessarily one either, but I'd be a lot happier without any loops.

Admiral

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement