本文整理汇总了Java中com.jme3.scene.Node.setLocalRotation方法的典型用法代码示例。如果您正苦于以下问题:Java Node.setLocalRotation方法的具体用法?Java Node.setLocalRotation怎么用?Java Node.setLocalRotation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.scene.Node
的用法示例。
在下文中一共展示了Node.setLocalRotation方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setCollisionPlane
import com.jme3.scene.Node; //导入方法依赖的package包/类
@Override
public void setCollisionPlane(@NotNull final CollisionResult collisionResult) {
final EditorTransformSupport editorControl = getEditorControl();
final Transform transform = editorControl.getTransformCenter();
if (transform == null) {
LOGGER.warning(this, "not found transform center for the " + editorControl);
return;
}
detectPickedAxis(editorControl, collisionResult);
// set the collision Plane location and rotation
final Node collisionPlane = getCollisionPlane();
collisionPlane.setLocalTranslation(transform.getTranslation());
collisionPlane.setLocalRotation(Quaternion.IDENTITY);
}
示例2: updateModel
import com.jme3.scene.Node; //导入方法依赖的package包/类
/**
* Update position and rotation of a model.
*/
@JMEThread
public void updateModel() {
final Node model = getModel();
if (model == null) return;
final LocalObjects local = LocalObjects.get();
final Vector3f positionOnCamera = local.nextVector();
positionOnCamera.set(getLocalTranslation())
.subtractLocal(camera.getLocation())
.normalizeLocal()
.multLocal(camera.getFrustumNear() + 0.4f)
.addLocal(camera.getLocation());
model.setLocalTranslation(positionOnCamera);
model.setLocalRotation(getLocalRotation());
}
示例3: prepareToMove
import com.jme3.scene.Node; //导入方法依赖的package包/类
@Override
@JMEThread
public void prepareToMove(@NotNull final Node parent, @NotNull final Node child,
@NotNull final Transform transform, @NotNull final Camera camera) {
parent.setLocalTranslation(Vector3f.ZERO);
parent.setLocalRotation(Quaternion.IDENTITY);
child.setLocalTranslation(transform.getTranslation());
child.setLocalRotation(transform.getRotation());
}
示例4: sync
import com.jme3.scene.Node; //导入方法依赖的package包/类
/**
* Synchronize this node with audio node.
*/
@JMEThread
public void sync() {
final AudioNode audioNode = getAudioNode();
if (audioNode == null) return;
final LocalObjects local = LocalObjects.get();
final Quaternion rotation = local.nextRotation();
rotation.lookAt(audioNode.getDirection(), camera.getUp(local.nextVector()));
final Node editedNode = getEditedNode();
editedNode.setLocalRotation(rotation);
editedNode.setLocalTranslation(audioNode.getLocalTranslation());
}
示例5: updateModel
import com.jme3.scene.Node; //导入方法依赖的package包/类
/**
* Update position and rotation of a model.
*/
@JMEThread
public void updateModel() {
final AudioNode audioNode = getAudioNode();
final Node model = getModel();
if (model == null || audioNode == null) return;
final Node parent = audioNode.getParent();
if (parent != null) {
setLocalTranslation(parent.getWorldTranslation());
setLocalRotation(parent.getWorldRotation());
setLocalScale(parent.getWorldScale());
}
final Node editedNode = getEditedNode();
final LocalObjects local = LocalObjects.get();
final Vector3f positionOnCamera = local.nextVector();
positionOnCamera.set(editedNode.getWorldTranslation()).subtractLocal(camera.getLocation());
positionOnCamera.normalizeLocal();
positionOnCamera.multLocal(camera.getFrustumNear() + 0.4f);
positionOnCamera.addLocal(camera.getLocation());
model.setLocalTranslation(positionOnCamera);
model.setLocalRotation(editedNode.getLocalRotation());
}
示例6: sync
import com.jme3.scene.Node; //导入方法依赖的package包/类
/**
* Synchronize this node with presented object.
*/
@JMEThread
public void sync() {
final ScenePresentable object = getObject();
final Node editedNode = getEditedNode();
editedNode.setLocalRotation(object.getRotation());
editedNode.setLocalTranslation(object.getLocation());
editedNode.setLocalScale(object.getScale());
}
示例7: prepareToRotate
import com.jme3.scene.Node; //导入方法依赖的package包/类
@Override
@JMEThread
public void prepareToRotate(@NotNull final Node parent, @NotNull final Node child,
@NotNull final Transform transform, @NotNull final Camera camera) {
parent.setLocalRotation(Quaternion.IDENTITY);
child.setLocalRotation(transform.getRotation());
}
示例8: processTransform
import com.jme3.scene.Node; //导入方法依赖的package包/类
@Override
public void processTransform() {
final LocalObjects local = LocalObjects.get();
final EditorTransformSupport editorControl = getEditorControl();
final InputManager inputManager = EDITOR.getInputManager();
final Camera camera = editorControl.getCamera();
final Transform transform = notNull(editorControl.getTransformCenter());
// cursor position and selected position vectors
final Vector2f cursorPos = inputManager.getCursorPosition();
final Vector3f transformOnScreen = camera.getScreenCoordinates(transform.getTranslation());
final Vector2f selectedCoords = local.nextVector(transformOnScreen.getX(), transformOnScreen.getY());
//set new deltaVector if it's not set
if (Float.isNaN(editorControl.getTransformDeltaX())) {
editorControl.setTransformDeltaX(selectedCoords.getX() - cursorPos.getX());
editorControl.setTransformDeltaY(selectedCoords.getY() - cursorPos.getY());
}
// Picked vector
final TransformationMode transformationMode = editorControl.getTransformationMode();
final Vector3f pickedVector = transformationMode.getPickedVector(transform, editorControl.getPickedAxis(), camera);
final Vector3f deltaVector = local.nextVector(editorControl.getTransformDeltaX(), editorControl.getTransformDeltaY(), 0F);
// rotate according to angle
final Vector2f cursorDirection = selectedCoords.subtractLocal(cursorPos).normalizeLocal();
float angle = cursorDirection.angleBetween(local.nextVector(deltaVector.getX(), deltaVector.getY()));
angle = FastMath.RAD_TO_DEG * angle * FastMath.DEG_TO_RAD;
final Node parentNode = getParentNode();
final Node childNode = getChildNode();
transformationMode.prepareToRotate(parentNode, childNode, transform, camera);
final Quaternion rotation = parentNode.getLocalRotation();
final Vector3f axisToRotate = rotation.mult(pickedVector, local.nextVector());
float angleCheck = axisToRotate.angleBetween(camera.getDirection(local.nextVector()));
if (angleCheck > FastMath.HALF_PI) {
angle = -angle;
}
final Quaternion difference = local.nextRotation().fromAngleAxis(angle, pickedVector);
final Quaternion newRotation = rotation.mult(difference, local.nextRotation());
parentNode.setLocalRotation(newRotation);
final Spatial toTransform = notNull(editorControl.getToTransform());
toTransform.setLocalRotation(childNode.getWorldRotation());
editorControl.notifyTransformed(toTransform);
}