本文整理了Java中com.jme3.scene.Spatial.getWorldTranslation()
方法的一些代码示例,展示了Spatial.getWorldTranslation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Spatial.getWorldTranslation()
方法的具体详情如下:
包路径:com.jme3.scene.Spatial
类名称:Spatial
方法名:getWorldTranslation
[英]getWorldTranslation
retrieves the absolute translation of the spatial.
[中]getWorldTranslation
检索空间坐标的绝对平移。
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* Access whichever spatial translation corresponds to the physics location.
*
* @return the pre-existing location vector (in physics-space coordinates,
* not null)
*/
protected Vector3f getSpatialTranslation() {
if (applyLocal) {
return spatial.getLocalTranslation();
}
return spatial.getWorldTranslation();
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* Access whichever spatial translation corresponds to the physics location.
*
* @return the pre-existing vector (not null)
*/
private Vector3f getSpatialTranslation() {
if (applyLocal) {
return spatial.getLocalTranslation();
}
return spatial.getWorldTranslation();
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
private Vector3f getSpatialTranslation() {
if (applyLocal) {
return spatial.getLocalTranslation();
}
return spatial.getWorldTranslation();
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
private Vector3f getSpatialTranslation() {
if (applyLocal) {
return spatial.getLocalTranslation();
}
return spatial.getWorldTranslation();
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* Access whichever spatial translation corresponds to the physics location.
*
* @return the pre-existing location vector (in physics-space coordinates,
* not null)
*/
protected Vector3f getSpatialTranslation() {
if (applyLocal) {
return spatial.getLocalTranslation();
}
return spatial.getWorldTranslation();
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* Access whichever spatial translation corresponds to the physics location.
*
* @return the pre-existing vector (not null)
*/
private Vector3f getSpatialTranslation() {
if (applyLocal) {
return spatial.getLocalTranslation();
}
return spatial.getWorldTranslation();
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* Access whichever spatial translation corresponds to the physics location.
*
* @return the pre-existing vector (not null)
*/
private Vector3f getSpatialTranslation(){
if(motionState.isApplyPhysicsLocal()){
return spatial.getLocalTranslation();
}
return spatial.getWorldTranslation();
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* Access whichever spatial translation corresponds to the physics location.
*
* @return the pre-existing vector (not null)
*/
private Vector3f getSpatialTranslation(){
if(motionState.isApplyPhysicsLocal()){
return spatial.getLocalTranslation();
}
return spatial.getWorldTranslation();
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
private Vector3f getSpatialTranslation(){
if(motionState.isApplyPhysicsLocal()){
return spatial.getLocalTranslation();
}
return spatial.getWorldTranslation();
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
private Vector3f getSpatialTranslation(){
if(motionState.isApplyPhysicsLocal()){
return spatial.getLocalTranslation();
}
return spatial.getWorldTranslation();
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* Sets the spacial for the camera control, should only be used internally
* @param spatial
*/
public void setSpatial(Spatial spatial) {
target = spatial;
if (spatial == null) {
return;
}
computePosition();
prevPos = new Vector3f(target.getWorldTranslation());
cam.setLocation(pos);
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
@Override
public void update(float tpf) {
if (spatial == null) {
throw new IllegalArgumentException("The spatial to follow is null, please use the setTarget method");
}
target.setLocalTranslation(spatial.getWorldTranslation());
camNode.lookAt(target.getWorldTranslation(), upVector);
target.updateLogicalState(tpf);
target.updateGeometricState();
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* Centers the spatial in the origin of the world bound.
* @return The spatial on which this method is called, e.g <code>this</code>.
*/
public Spatial center() {
Vector3f worldTrans = getWorldTranslation();
Vector3f worldCenter = getWorldBound().getCenter();
Vector3f absTrans = worldTrans.subtract(worldCenter);
setLocalTranslation(absTrans);
return this;
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
@Override
protected void computeLastDistance(Spatial owner) {
if (owner.getWorldBound() != null) {
BoundingVolume bv = owner.getWorldBound();
lastDistance = bv.distanceSquaredTo(position);
} else {
lastDistance = owner.getWorldTranslation().distanceSquared(position);
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
@Override
protected void computeLastDistance(Spatial owner) {
if (owner.getWorldBound() != null) {
BoundingVolume bv = owner.getWorldBound();
lastDistance = bv.distanceSquaredTo(position);
} else {
lastDistance = owner.getWorldTranslation().distanceSquared(position);
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
@Override
public void computeLastDistance(Spatial owner) {
if (owner.getWorldBound() != null) {
BoundingVolume bv = owner.getWorldBound();
lastDistance = bv.distanceSquaredTo(position);
} else {
lastDistance = owner.getWorldTranslation().distanceSquared(position);
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
@Override
public void cloneFields( Cloner cloner, Object original ) {
this.target = cloner.clone(target);
computePosition();
prevPos = new Vector3f(target.getWorldTranslation());
cam.setLocation(pos);
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public void setSpatial(Spatial spatial) {
this.spatial = spatial;
setUserObject(spatial);
if (spatial == null) {
return;
}
setPhysicsLocation(spatial.getWorldTranslation());
setPhysicsRotation(spatial.getWorldRotation().toRotationMatrix());
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
protected void computePosition() {
float hDistance = (distance) * FastMath.sin((FastMath.PI / 2) - vRotation);
pos.set(hDistance * FastMath.cos(rotation), (distance) * FastMath.sin(vRotation), hDistance * FastMath.sin(rotation));
pos.addLocal(target.getWorldTranslation());
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
@Override
public Vector3f getFinalObserverPosition(int index) {
OSVRViewManager vrvm = (OSVRViewManager) environment.getVRViewManager();
if( vrvm == null || isInputDeviceTracking(index) == false ) return null;
Object obs = environment.getObserver();
Vector3f pos = getPosition(index);
if( obs instanceof Camera ) {
((Camera)obs).getRotation().mult(pos, pos);
return pos.addLocal(((Camera)obs).getLocation());
} else {
((Spatial)obs).getWorldRotation().mult(pos, pos);
return pos.addLocal(((Spatial)obs).getWorldTranslation());
}
}
内容来源于网络,如有侵权,请联系作者删除!