jogl - OpenGL find distance to a point -


i have virtual landscape ability walk around in first-person. want able walk slope if 45 degrees or less. far know, involves translating current position out x units finding distance between translated point , ground. if distance x units or more, user can walk there. if not, user cannot. have no idea how find distance between 1 point , nearest point in negative y direction. have programmed in java3d, not know how program in opengl.

barking problem @ opengl barking wrong tree: opengl's sole purpose drawing nice pictures screen. it's not math library!

depending demands there several solutions. how i'd tackle problem: normals calculate proper shading give slope of each point. heightmap (=terrain) in xy plane , gravity vector g = -z, normal force terrain_normal(x,y) · g. normal force is, "pushes" feet against ground. without sufficient normal force, there's not enough friction convey muscles force movement perpendicular ground. if @ normal force formula can see more angle between g , terrain_normal(x,y) deviates, smaller normal force.

so in program test if normal force exceeds threshold; correctly you'd project excerted friction force onto terrain, , use acceleration vector.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -