import org.lwjgl.opengl.GL11; public class Legs { Vector3D pos; Vector3D dir; Legs(Vector3D pos_) { pos=new Vector3D(); pos.setXYZ(pos_); dir=new Vector3D(); } void initialize() { pos=new Vector3D(); dir=new Vector3D(); } void setpos(Vector3D pos_) { pos.setXYZ(pos_);} void setdir(Vector3D front, Vector3D rear) { crossProduct(front, rear, dir); dir.normalize(); //Now shrink the vector; dir.mult(.3f); } void render() { Vector3D L, R; L=new Vector3D(); R=new Vector3D(); L.setXYZ(pos); L.sub(dir); R.setXYZ(pos); R.add(dir); GL11.glColor3f(.5f, .5f, .5f); GL11.glLineWidth(1); GL11.glBegin(GL11.GL_LINE_STRIP); GL11.glVertex3f(L.x(), L.y(), L.z()); GL11.glVertex3f( R.x(), R.y(), R.z()); GL11.glEnd(); } void crossProduct(Vector3D a, Vector3D b, Vector3D target) { target.setXYZ(a.y()*b.z() - a.z()*b.y(), a.z()*b.x() - a.x()*b.z(), a.x()*b.y() - a.y()*b.x()); } }//END Legs