public void applyTo(final Spatial spat) { spat.setTransform(Transform.IDENTITY); spat.setRotation(getRotation()); spat.setScale(getScale()); spat.setTranslation(getTranslation()); }
public void applyTo(final Spatial spat) { spat.setTransform(Transform.IDENTITY); spat.setRotation(getRotation()); spat.setScale(getScale()); spat.setTranslation(getTranslation()); }
/** * Interpolates between the given quaternions using the * {@link Quaternion#slerpLocal(ReadOnlyQuaternion, ReadOnlyQuaternion, double)} method. */ @Override protected void interpolate(final ReadOnlyQuaternion from, final ReadOnlyQuaternion to, final double delta, final Spatial caller) { assert (null != from) : "parameter 'from' can not be null"; assert (null != to) : "parameter 'to' can not be null"; assert (null != caller) : "parameter 'caller' can not be null"; final Quaternion tempQuat = Quaternion.fetchTempInstance(); tempQuat.slerpLocal(from, to, delta); if (isLocalRotation()) { caller.setRotation(tempQuat); } else { caller.setWorldRotation(tempQuat); } Quaternion.releaseTempInstance(tempQuat); }
/** * Interpolates between the given quaternions using the * {@link Quaternion#slerpLocal(ReadOnlyQuaternion, ReadOnlyQuaternion, double)} method. */ @Override protected void interpolate(final ReadOnlyQuaternion from, final ReadOnlyQuaternion to, final double delta, final Spatial caller) { assert (null != from) : "parameter 'from' can not be null"; assert (null != to) : "parameter 'to' can not be null"; assert (null != caller) : "parameter 'caller' can not be null"; final Quaternion tempQuat = Quaternion.fetchTempInstance(); tempQuat.slerpLocal(from, to, delta); if (isLocalRotation()) { caller.setRotation(tempQuat); } else { caller.setWorldRotation(tempQuat); } Quaternion.releaseTempInstance(tempQuat); }
@Override public void update(final double time, final Spatial caller) { if (null == caller) { throw new IllegalArgumentException("caller can not be null!"); } final Vector3 interpolated = Vector3.fetchTempInstance(); final Matrix3 rotation = Matrix3.fetchTempInstance(); _curveController.interpolateVectors(_curveController.getControlFrom(), _curveController.getControlTo(), _curveController.getDelta(), interpolated); MathUtils.matrixLookAt(_previous, interpolated, _worldUp, rotation); if (isLocalRotation()) { caller.setRotation(rotation); } else { caller.setWorldRotation(rotation); } _previous.set(interpolated); Matrix3.releaseTempInstance(rotation); Vector3.releaseTempInstance(interpolated); }
@Override public void update(final double time, final Spatial caller) { if (null == caller) { throw new IllegalArgumentException("caller can not be null!"); } final Vector3 interpolated = Vector3.fetchTempInstance(); final Matrix3 rotation = Matrix3.fetchTempInstance(); _curveController.interpolateVectors(_curveController.getControlFrom(), _curveController.getControlTo(), _curveController.getDelta(), interpolated); MathUtils.matrixLookAt(_previous, interpolated, _worldUp, rotation); if (isLocalRotation()) { caller.setRotation(rotation); } else { caller.setWorldRotation(rotation); } _previous.set(interpolated); Matrix3.releaseTempInstance(rotation); Vector3.releaseTempInstance(interpolated); }