Java Code Examples for com.jme3.math.FastMath#HALF_PI
The following examples show how to use
com.jme3.math.FastMath#HALF_PI .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestOgreComplexAnim.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void simpleUpdate(float tpf) { Joint j = skinningControl.getArmature().getJoint("spinehigh"); Joint j2 = skinningControl.getArmature().getJoint("uparm.left"); angle += tpf * rate; if (angle > FastMath.HALF_PI / 2f) { angle = FastMath.HALF_PI / 2f; rate = -1; } else if (angle < -FastMath.HALF_PI / 2f) { angle = -FastMath.HALF_PI / 2f; rate = 1; } Quaternion q = new Quaternion(); q.fromAngles(0, angle, 0); j.setLocalRotation(j.getInitialTransform().getRotation().mult(q)); j2.setLocalScale(j.getInitialTransform().getScale().mult(new Vector3f(1 + angle, 1 + angle, 1 + angle))); }
Example 2
Source File: TestOgreComplexAnim.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
@Override public void simpleUpdate(float tpf){ Bone b = control.getSkeleton().getBone("spinehigh"); Bone b2 = control.getSkeleton().getBone("uparm.left"); angle += tpf * rate; if (angle > FastMath.HALF_PI / 2f){ angle = FastMath.HALF_PI / 2f; rate = -1; }else if (angle < -FastMath.HALF_PI / 2f){ angle = -FastMath.HALF_PI / 2f; rate = 1; } Quaternion q = new Quaternion(); q.fromAngles(0, angle, 0); b.setUserControl(true); b.setUserTransforms(Vector3f.ZERO, q, Vector3f.UNIT_XYZ); b2.setUserControl(true); b2.setUserTransforms(Vector3f.ZERO, Quaternion.IDENTITY, new Vector3f(1+angle,1+ angle, 1+angle)); }
Example 3
Source File: TestAndroidSensors.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 4 votes |
public void onAnalog(String string, float value, float tpf) { logger.log(Level.INFO, "onAnalog for {0}, value: {1}, tpf: {2}", new Object[]{string, value, tpf}); float scaledValue = value; if (string.equalsIgnoreCase(ORIENTATION_X_PLUS)) { if (useAbsolute) { // set rotation amount // divide by tpf to get back to actual axis value (0 to 1) // multiply by 90deg so that 90deg = full axis (value = tpf) anglesCurrent[0] = (scaledValue / tpf * FastMath.HALF_PI); } else { // apply an incremental rotation amount based on rotationSpeed anglesCurrent[0] += scaledValue * rotationSpeedX; } } if (string.equalsIgnoreCase(ORIENTATION_X_MINUS)) { if (useAbsolute) { // set rotation amount // divide by tpf to get back to actual axis value (0 to 1) // multiply by 90deg so that 90deg = full axis (value = tpf) anglesCurrent[0] = (-scaledValue / tpf * FastMath.HALF_PI); } else { // apply an incremental rotation amount based on rotationSpeed anglesCurrent[0] -= scaledValue * rotationSpeedX; } } if (string.equalsIgnoreCase(ORIENTATION_Y_PLUS)) { if (useAbsolute) { // set rotation amount // divide by tpf to get back to actual axis value (0 to 1) // multiply by 90deg so that 90deg = full axis (value = tpf) anglesCurrent[1] = (scaledValue / tpf * FastMath.HALF_PI); } else { // apply an incremental rotation amount based on rotationSpeed anglesCurrent[1] += scaledValue * rotationSpeedY; } } if (string.equalsIgnoreCase(ORIENTATION_Y_MINUS)) { if (useAbsolute) { // set rotation amount // divide by tpf to get back to actual axis value (0 to 1) // multiply by 90deg so that 90deg = full axis (value = tpf) anglesCurrent[1] = (-scaledValue / tpf * FastMath.HALF_PI); } else { // apply an incremental rotation amount based on rotationSpeed anglesCurrent[1] -= scaledValue * rotationSpeedY; } } }
Example 4
Source File: SpotLight.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 3 votes |
/** * Sets the inner angle of the cone of influence. * <p> * Must be between 0 and pi/2. * <p> * This angle is the angle between the spot direction axis and the inner border of the cone of influence. * @param spotInnerAngle */ public void setSpotInnerAngle(float spotInnerAngle) { if (spotInnerAngle < 0f || spotInnerAngle >= FastMath.HALF_PI) { throw new IllegalArgumentException("spot angle must be between 0 and pi/2"); } this.spotInnerAngle = spotInnerAngle; computeAngleParameters(); }
Example 5
Source File: SpotLight.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 3 votes |
/** * Sets the outer angle of the cone of influence. * <p> * Must be between 0 and pi/2. * <p> * This angle is the angle between the spot direction axis and the outer border of the cone of influence. * this should be greater than the inner angle or the result will be unexpected. * @param spotOuterAngle */ public void setSpotOuterAngle(float spotOuterAngle) { if (spotOuterAngle < 0f || spotOuterAngle >= FastMath.HALF_PI) { throw new IllegalArgumentException("spot angle must be between 0 and pi/2"); } this.spotOuterAngle = spotOuterAngle; computeAngleParameters(); }