本文整理了Java中com.jme3.scene.Spatial.getLocalTranslation()
方法的一些代码示例,展示了Spatial.getLocalTranslation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Spatial.getLocalTranslation()
方法的具体详情如下:
包路径:com.jme3.scene.Spatial
类名称:Spatial
方法名:getLocalTranslation
[英]getLocalTranslation
retrieves the local translation of this node.
[中]getLocalTranslation
检索此节点的本地翻译。
代码示例来源: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
private void updateMarkerElevations() {
for (Spatial s : markers.getChildren()) {
float h = terrain.getHeight(new Vector2f(s.getLocalTranslation().x, s.getLocalTranslation().z));
s.setLocalTranslation(s.getLocalTranslation().x, h+1, s.getLocalTranslation().z);
}
}
代码示例来源: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(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
/**
* 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
@Override
public void setSpatial(Spatial spatial) {
super.setSpatial(spatial); //To change body of generated methods, choose Tools | Templates.
origPos.set(spatial.getLocalTranslation());
}
float time = 0;
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public void getAllTerrainPatchesWithTranslation(Map<TerrainPatch,Vector3f> holder, Vector3f translation) {
if (children != null) {
for (int i = children.size(); --i >= 0;) {
Spatial child = children.get(i);
if (child instanceof TerrainQuad) {
((TerrainQuad) child).getAllTerrainPatchesWithTranslation(holder, translation.clone().add(child.getLocalTranslation()));
} else if (child instanceof TerrainPatch) {
//if (holder.size() < 4)
holder.put((TerrainPatch)child, translation.clone().add(child.getLocalTranslation()));
}
}
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public void collision(PhysicsCollisionEvent event) {
if (event.getObjectA() instanceof BombControl) {
final Spatial node = event.getNodeA();
effect.killAllParticles();
effect.setLocalTranslation(node.getLocalTranslation());
effect.emitAllParticles();
} else if (event.getObjectB() instanceof BombControl) {
final Spatial node = event.getNodeB();
effect.killAllParticles();
effect.setLocalTranslation(node.getLocalTranslation());
effect.emitAllParticles();
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* Update this control. Invoked once per frame during the logical-state
* update, provided the control is added to a scene. Do not invoke directly
* from user code.
*
* @param tpf the time interval between frames (in seconds, ≥0)
*/
@Override
public void update(float tpf) {
if (!enabled) {
return;
}
if(mode == Mode.IK){
ikUpdate(tpf);
} else if (mode == mode.Ragdoll && targetModel.getLocalTranslation().equals(modelPosition)) {
//if the ragdoll has the control of the skeleton, we update each bone with its position in physics world space.
ragDollUpdate(tpf);
} else {
kinematicUpdate(tpf);
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
private void lightToSpatial(Light light) {
TempVars vars = TempVars.get();
if (light instanceof PointLight) {
PointLight pLight = (PointLight) light;
Vector3f vecDiff = vars.vect1.set(pLight.getPosition()).subtractLocal(spatial.getWorldTranslation());
spatial.setLocalTranslation(vecDiff.addLocal(spatial.getLocalTranslation()));
}
if (light instanceof DirectionalLight) {
DirectionalLight dLight = (DirectionalLight) light;
vars.vect1.set(dLight.getDirection()).multLocal(-1.0f);
Vector3f vecDiff = vars.vect1.subtractLocal(spatial.getWorldTranslation());
spatial.setLocalTranslation(vecDiff.addLocal(spatial.getLocalTranslation()));
}
vars.release();
//TODO add code for Spot light here when it's done
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public void generateDebugTangents(Material mat) {
for (int x = children.size(); --x >= 0;) {
Spatial child = children.get(x);
if (child instanceof TerrainQuad) {
((TerrainQuad)child).generateDebugTangents(mat);
} else if (child instanceof TerrainPatch) {
Geometry debug = new Geometry( "Debug " + name,
TangentBinormalGenerator.genTbnLines( ((TerrainPatch)child).getMesh(), 0.8f));
attachChild(debug);
debug.setLocalTranslation(child.getLocalTranslation());
debug.setCullHint(CullHint.Never);
debug.setMaterial(mat);
}
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public void collision(PhysicsCollisionEvent event) {
if (space == null) {
return;
}
if (event.getObjectA() == this || event.getObjectB() == this) {
space.add(ghostObject);
ghostObject.setPhysicsLocation(getPhysicsLocation(vector));
space.addTickListener(this);
if (effect != null && spatial.getParent() != null) {
curTime = 0;
effect.setLocalTranslation(spatial.getLocalTranslation());
spatial.getParent().attachChild(effect);
effect.emitAllParticles();
}
space.remove(this);
spatial.removeFromParent();
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
private void createCameraMotion() {
CameraNode camNode = cinematic.bindCamera("topView", cam);
camNode.setLocalTranslation(new Vector3f(0, 50, 0));
camNode.lookAt(teapot.getLocalTranslation(), Vector3f.UNIT_Y);
CameraNode camNode2 = cinematic.bindCamera("aroundCam", cam);
path = new MotionPath();
path.setCycle(true);
path.addWayPoint(new Vector3f(20, 3, 0));
path.addWayPoint(new Vector3f(0, 3, 20));
path.addWayPoint(new Vector3f(-20, 3, 0));
path.addWayPoint(new Vector3f(0, 3, -20));
path.setCurveTension(0.83f);
cameraMotionEvent = new MotionEvent(camNode2, path);
cameraMotionEvent.setLoopMode(LoopMode.Loop);
cameraMotionEvent.setLookAt(model.getWorldTranslation(), Vector3f.UNIT_Y);
cameraMotionEvent.setDirectionType(MotionEvent.Direction.LookAt);
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public void applyWheelTransform() {
if (wheelSpatial == null) {
return;
}
Quaternion localRotationQuat = wheelSpatial.getLocalRotation();
Vector3f localLocation = wheelSpatial.getLocalTranslation();
if (!applyLocal && wheelSpatial.getParent() != null) {
localLocation.set(wheelWorldLocation).subtractLocal(wheelSpatial.getParent().getWorldTranslation());
localLocation.divideLocal(wheelSpatial.getParent().getWorldScale());
tmp_inverseWorldRotation.set(wheelSpatial.getParent().getWorldRotation()).inverseLocal().multLocal(localLocation);
localRotationQuat.set(wheelWorldRotation);
tmp_inverseWorldRotation.set(wheelSpatial.getParent().getWorldRotation()).inverseLocal().mult(localRotationQuat, localRotationQuat);
wheelSpatial.setLocalTranslation(localLocation);
wheelSpatial.setLocalRotation(localRotationQuat);
} else {
wheelSpatial.setLocalTranslation(wheelWorldLocation);
wheelSpatial.setLocalRotation(wheelWorldRotation);
}
}
内容来源于网络,如有侵权,请联系作者删除!