本文整理了Java中com.jme3.scene.Spatial.removeControl()
方法的一些代码示例,展示了Spatial.removeControl()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Spatial.removeControl()
方法的具体详情如下:
包路径:com.jme3.scene.Spatial
类名称:Spatial
方法名:removeControl
[英]Removes the given control from this spatial's controls.
[中]从该空间的控件中删除给定控件。
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* Call this when you remove the terrain or this control from the scene.
* It will clear up any threads it had.
*/
public void detachAndCleanUpControl() {
if (indexer != null) {
indexer.cancel(true);
indexer = null;
}
getSpatial().removeControl(this);
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* Internal use only.
*/
@Override
public void setSpatial(Spatial spatial) {
if (spatial == null && skeletonControl != null) {
this.spatial.removeControl(skeletonControl);
}
super.setSpatial(spatial);
//Backward compatibility.
if (spatial != null && skeletonControl != null) {
spatial.addControl(skeletonControl);
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
@Override
public void visit(Spatial spatial) {
SkeletonControl control = spatial.getControl(SkeletonControl.class);
if (control != null) {
Armature armature = skeletonArmatureMap.get(control.getSkeleton());
SkinningControl skinningControl = new SkinningControl(armature);
Map<String, List<Spatial>> attachedSpatials = new HashMap<>();
for (int i = 0; i < control.getSkeleton().getBoneCount(); i++) {
Bone b = control.getSkeleton().getBone(i);
Node n = control.getAttachmentsNode(b.getName());
n.removeFromParent();
if (!n.getChildren().isEmpty()) {
attachedSpatials.put(b.getName(), n.getChildren());
}
}
spatial.removeControl(control);
spatial.addControl(skinningControl);
for (String name : attachedSpatials.keySet()) {
List<Spatial> spatials = attachedSpatials.get(name);
for (Spatial child : spatials) {
skinningControl.getAttachmentsNode(name).attachChild(child);
}
}
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
spatial.removeControl(control);
spatial.addControl(composer);
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
throw new IllegalArgumentException("The root node of the model should have a SkeletonControl. Make sure the control is there and that it's not on a sub node.");
model.removeControl(sc);
model.addControl(sc);
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
throw new IllegalArgumentException("The root node of the model should have a SkeletonControl. Make sure the control is there and that it's not on a sub node.");
model.removeControl(sc);
model.addControl(sc);
代码示例来源:origin: net.sf.phat/phat-audio
@Override
protected void removeMic() {
if (currentMicControl != null) {
currentMicControl.getSpatial().removeControl(currentMicControl);
}
}
}
代码示例来源:origin: us.ihmc.thirdparty.jme/jme3-terrain
/**
* Call this when you remove the terrain or this control from the scene.
* It will clear up any threads it had.
*/
public void detachAndCleanUpControl() {
if (executor != null)
executor.shutdownNow();
getSpatial().removeControl(this);
}
代码示例来源:origin: org.jmonkeyengine/jme3-core
/**
* Internal use only.
*/
@Override
public void setSpatial(Spatial spatial) {
if (spatial == null && skeletonControl != null) {
this.spatial.removeControl(skeletonControl);
}
super.setSpatial(spatial);
//Backward compatibility.
if (spatial != null && skeletonControl != null) {
spatial.addControl(skeletonControl);
}
}
代码示例来源:origin: info.projectkyoto/mms-engine
/**
* Internal use only.
*/
@Override
public void setSpatial(Spatial spatial) {
if (spatial == null && skeletonControl != null) {
this.spatial.removeControl(skeletonControl);
}
super.setSpatial(spatial);
//Backward compatibility.
if (spatial != null && skeletonControl != null) {
spatial.addControl(skeletonControl);
}
}
代码示例来源:origin: tonihele/OpenKeeper
@Override
protected void controlUpdate(float tpf) {
if (!isEnabled() || spatial == null) {
return;
}
if (tick > 1) {
spatial.removeControl(this);
onExit();
return;
}
moveCamera();
tick += tpf * SPEED;
}
代码示例来源:origin: net.sf.phat/phat-audio
@Override
protected void removeMic() {
if (currentMicControl != null) {
currentMicControl.remove(pcSpeaker);
if (chart != null) {
chart.dispose();
currentMicControl.remove(chart);
}
currentMicControl.getSpatial().removeControl(currentMicControl);
}
}
代码示例来源:origin: tonihele/OpenKeeper
@Override
protected void controlUpdate(float tpf) {
Vector3f pos = spatial.getLocalTranslation();
// FIXME set real height by BoundingBox height
if (pos.y > MapLoader.FLOOR_HEIGHT + 0.3f) {
spatial.move(0, -tpf * GRAVITY, 0);
} else {
enabled = false;
spatial.setLocalTranslation(pos.x, MapLoader.FLOOR_HEIGHT + 0.3f, pos.z);
spatial.removeControl(this);
onLanded();
}
}
代码示例来源:origin: net.sf.phat/phat-server
@Override
public void runCommand(Application app) {
DevicesAppState devicesAppState = app.getStateManager().getState(DevicesAppState.class);
ServerAppState serverAppState = app.getStateManager().getState(ServerAppState.class);
Node device = devicesAppState.getDevice(smartphoneId);
AndroidVirtualDevice avd = serverAppState.getAVD(smartphoneId);
if (device != null && avd != null) {
List<Spatial> screens = SpatialUtils.getSpatialsByRole(device, "Screen");
System.out.println("#Screen = " + screens.size());
if (screens.size() > 0) {
Spatial screen = screens.get(0);
ScreenAVDControl c = screen.getControl(ScreenAVDControl.class);
if (on && c == null) {
screen.setMaterial(new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"));
c = new ScreenAVDControl((Geometry) screen, avd);
screen.addControl(c);
c.setFrecuency(frecuency);
} else if (!on && c != null) {
screen.removeControl(c);
}
setState(State.Success);
return;
}
}
setState(State.Fail);
}
@Override
代码示例来源:origin: org.jmonkeyengine/jme3-jbullet
throw new IllegalArgumentException("The root node of the model should have a SkeletonControl. Make sure the control is there and that it's not on a sub node.");
model.removeControl(sc);
model.addControl(sc);
代码示例来源:origin: tonihele/OpenKeeper
@Override
protected void controlUpdate(float tpf) {
// TODO add normal physics control
if (tick > 11) {
plugDecay.removeFromParent();
spatial.removeControl(this);
} else if (tick > 9) {
velocity -= GRAVITY * tpf;
for (Spatial piece : plugDecay.getChildren()) {
float rotate = (float) piece.getUserData("rotate") * 10 * tpf;
float pv = (float) piece.getUserData("velocity") - GRAVITY * tpf;
piece.setUserData("velocity", pv);
piece.move(0, pv * tpf, 0);
//float step = (float) piece.getUserData("yAngle");
//piece.move(tpf * FastMath.cos(step), velocity * tpf, tpf * FastMath.sin(step));
piece.rotate(rotate, rotate, rotate);
}
} else if (tick > 6) {
plug.removeFromParent();
plugDecay.setCullHint(Spatial.CullHint.Inherit);
}
tick += tpf;
}
代码示例来源:origin: org.jmonkeyengine/jme3-bullet
throw new IllegalArgumentException("The root node of the model should have a SkeletonControl. Make sure the control is there and that it's not on a sub node.");
model.removeControl(sc);
model.addControl(sc);
代码示例来源:origin: tonihele/OpenKeeper
onDie(spatial.getLocalTranslation());
spatial.removeFromParent();
spatial.removeControl(this);
代码示例来源:origin: info.projectkyoto/mms-engine
model.removeControl(sc);
model.addControl(sc);
代码示例来源:origin: tonihele/OpenKeeper
@Override
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
if (enabled) {
// The camera
camera = new PossessionCamera(app.getCamera(), creature.getAttributes().getSpeed(), creature.getFirstPersonOscillateScale());
loadCameraStartLocation();
FunnyCameraContol fcc = new FunnyCameraContol(app.getCamera(), target.getSpatial());
fcc.setLookAtOffset(new Vector3f(0, creature.getAttributes().getEyeHeight(), 0));
fcc.setHeight(creature.getAttributes().getHeight());
fcc.setDistance(1.5f);
// The controls
registerInput();
} else {
unregisterInput();
target.getSpatial().removeControl(FunnyCameraContol.class);
target = null;
}
}
内容来源于网络,如有侵权,请联系作者删除!