use of com.jogamp.opengl.math.Quaternion in project narchy by automenta.
the class Flatten method accept.
@Override
public void accept(Spatial<X> ss) {
if (ss instanceof SimpleSpatial) {
SimpleSpatial s = (SimpleSpatial) ss;
// v3 f = v();
// locate(s, f);
// s.move(f, rate);
Body3D b = s.body;
if (b == null)
return;
float tz = b.transform.z;
if (Math.abs(tz) > zTolerance) {
// b.velAdd(v( 0, 0,
// -(tz > 0 ? (tz - zTolerance) : (tz + zTolerance)) * zSpeed));
b.linearVelocity.z *= zSpeed;
b.transform.z *= zSpeed;
} else {
// dont affect
}
s.rotate(up, rotateRate, new Quaternion());
// dampening: keep upright and eliminate z-component of linear velocity
// b.linearVelocity.scale(
// 1f, 1f, 0.9f
// );
// b.angularVelocity.scale(1f-rotateRate);
// b.angularVelocity.zero();
}
}
use of com.jogamp.opengl.math.Quaternion in project narchy by automenta.
the class SimpleSpatial method rotate.
public void rotate(Quaternion target, float speed, Quaternion tmp) {
// if (motionLock)
// return;
Quaternion current = transform.getRotation(tmp);
current.setSlerp(current, target, speed);
transform.setRotation(current);
reactivate();
}
use of com.jogamp.opengl.math.Quaternion in project narchy by automenta.
the class SimpleSpatial method rotate.
public void rotate(float tx, float ty, float tz, float angle, float speed) {
Quaternion q = transform.getRotation(new Quaternion());
q.rotateByAngleNormalAxis(angle, tx, ty, tz);
rotate(q, speed);
}
Aggregations