public void DrawLine(OpenGL gl, ObjectMesh origin, Vector3 target, float MultScale = 1.0f, byte r = 28, byte g = 120, byte b = 186) { gl.Color(r, g, b); gl.Begin(OpenGL.GL_LINE_STRIP); gl.Vertex(origin.Position.x, origin.Position.y, origin.Position.z); gl.Vertex((origin.Position.x + target.x) * MultScale, (origin.Position.y + target.y) * MultScale, origin.Position.z); gl.End(); UpdateMotion(); }
public void DrawSimulatedPath(OpenGL gl, ObjectMesh ball, Vector3 target, float MultScale = 1.0f, byte r = 28, byte g = 120, byte b = 186) { gl.Color(r, g, b); gl.Begin(OpenGL.GL_LINE_STRIP); gl.Vertex(ball.Position.x, ball.Position.y, ball.Position.z); for (int i = 0; i < 90; i++) { gl.Vertex(ball.Position.x, ball.Position.y, ball.Position.z); } gl.End(); }
public bool HasCollidedWith(ObjectMesh target) { if ((this.Type == "Circle") && (target.Type == "Circle")) { bool xHasNotCollided = this.Position.x - this.Radius - (this.Velocity.x / 2) > target.Position.x + target.Radius || this.Position.x + this.Radius + (this.Velocity.x / 2) < target.Position.x - target.Radius; bool yHasNotCollided = this.Position.y - this.Radius + (this.Velocity.y / 2) > target.Position.y + target.Radius || this.Position.y + this.Radius - (this.Velocity.y / 2) < target.Position.y - target.Radius; bool zHasNotCollided = this.Position.z - this.Radius > target.Position.z + target.Scale.z || this.Position.z + this.Radius < target.Position.z - target.Scale.z; return(!(xHasNotCollided || yHasNotCollided || zHasNotCollided)); } else if ((this.Type == "Circle")) { bool xHasNotCollided = this.Position.x - this.Radius - (this.Velocity.x / 2) > target.Position.x + target.Scale.x || this.Position.x + this.Radius + (this.Velocity.x / 2) < target.Position.x - target.Scale.x; bool yHasNotCollided = this.Position.y - this.Radius + (this.Velocity.y / 2) > target.Position.y + target.Scale.y || this.Position.y + this.Radius - (this.Velocity.y / 2) < target.Position.y - target.Scale.y; bool zHasNotCollided = this.Position.z - this.Radius > target.Position.z + target.Scale.z || this.Position.z + this.Radius < target.Position.z - target.Scale.z; return(!(xHasNotCollided || yHasNotCollided || zHasNotCollided)); } else { bool xHasNotCollided = this.Position.x - this.Scale.x - (this.Velocity.x / 2) > target.Position.x + target.Scale.x || this.Position.x + this.Scale.x + (this.Velocity.x / 2) < target.Position.x - target.Scale.x; bool yHasNotCollided = this.Position.y - this.Scale.y + (this.Velocity.y / 2) > target.Position.y + target.Scale.y || this.Position.y + this.Scale.y - (this.Velocity.y / 2) < target.Position.y - target.Scale.y; bool zHasNotCollided = this.Position.z - this.Scale.z > target.Position.z + target.Scale.z || this.Position.z + this.Scale.z < target.Position.z - target.Scale.z; return(!(xHasNotCollided || yHasNotCollided || zHasNotCollided)); } }