/** * 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(); }
private Vector3f getSpatialTranslation() { if (applyLocal) { return spatial.getLocalTranslation(); } return spatial.getWorldTranslation(); }
private Vector3f getSpatialTranslation() { if (applyLocal) { return spatial.getLocalTranslation(); } return spatial.getWorldTranslation(); }
/** * 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(); }
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); } }
/** * 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(); }
/** * 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(); }
private Vector3f getSpatialTranslation(){ if(motionState.isApplyPhysicsLocal()){ return spatial.getLocalTranslation(); } return spatial.getWorldTranslation(); }
private Vector3f getSpatialTranslation(){ if(motionState.isApplyPhysicsLocal()){ return spatial.getLocalTranslation(); } return spatial.getWorldTranslation(); }
/** * 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(); }
/** * 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(); }
@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;
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())); } } } }
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(); } }
/** * 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); } }
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 }
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); } } }
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(); } }
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); }
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); } }