public void rotate(Vector3 v) { double ts = -this.x * v.x - this.y * v.y - this.z * v.z; double tx = this.s * v.x + this.y * v.z - this.z * v.y; double ty = this.s * v.y - this.x * v.z + this.z * v.x; double tz = this.s * v.z + this.x * v.y - this.y * v.x; v.x = (tx * this.s - ts * this.x - ty * this.z + tz * this.y); v.y = (ty * this.s - ts * this.y + tx * this.z - tz * this.x); v.z = (tz * this.s - ts * this.z - tx * this.y + ty * this.x); }
public Raycaster pickingRay(Vector3 vector, Camera camera) { vector.z = -1.0f; Vector3 end = new Vector3(vector.x, vector.y, 1.0f); unprojectVector(vector, camera); unprojectVector(end, camera); end.sub(vector).normalize(); return new Raycaster(vector, end); }
public final void addToPosition(final float _x, final float _y, final float _z) { position.x += _x; position.y += _y; position.z += _z; }
public final void setPosition(final float _x, final float _y, final float _z) { position.x = _x; position.y = _y; position.z = _z; }
public Vector3 add(Vector3 v) { return new Vector3(x() + v.x(), y() + v.y(), z() + v.z()); }