Posted By: emo10001
Player floats above ground. - 07/10/11 23:37
After adding shadows to my model...my suspicion that he was floating was confirmed. I looked at another post here about floating models, but the only answer given was that "something should be a negative number instead".
I'm using the "Improved Player Movement" script from the wiki ( http://www.opserver.de/wiki/index.php/Improved_Player_Movement )
While I think I understand the basics of c_trace...I'm certainly no expert. This is what I'm getting:
I can move my player just fine....but he's always that high above my terrain.
Snippets of the code are
Any thoughts?
I'm using the "Improved Player Movement" script from the wiki ( http://www.opserver.de/wiki/index.php/Improved_Player_Movement )
While I think I understand the basics of c_trace...I'm certainly no expert. This is what I'm getting:
I can move my player just fine....but he's always that high above my terrain.
Snippets of the code are
Code:
//determine player height c_setminmax(my); wait(1); var feedheight = -my.min_z; //check distance to ground grounddist = c_trace(my.x, vector(my.x, my.y, my.z-10000), IGNORE_ME|IGNORE_PASSABLE)-feedheight; if(grounddist > 0 || movedir.z < 0) { //gravity acceleration movedir.z += fallacc*time_step; }else { movedir.z = 0; } //apply gravity my.z -= minv(movedir.z*time_step, grounddist); if(grounddist-minv(movedir.z*time_step, grounddist) == 0) { //jump if(key_space) { movedir.z = -jumpacc; } }
Any thoughts?