本文整理了Java中com.jme3.scene.Spatial.getLocalTransform()
方法的一些代码示例,展示了Spatial.getLocalTransform()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Spatial.getLocalTransform()
方法的具体详情如下:
包路径:com.jme3.scene.Spatial
类名称:Spatial
方法名:getLocalTransform
[英]getLocalTransform
retrieves the local transform of this spatial.
[中]getLocalTransform
检索此空间的局部变换。
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
private void dumpScene(Spatial s, int indent) {
System.err.println(indentString.substring(0, indent) + s.getName() + " (" + s.getClass().getSimpleName() + ") / " +
s.getLocalTransform().getTranslation().toString() + ", " +
s.getLocalTransform().getRotation().toString() + ", " +
s.getLocalTransform().getScale().toString());
if (s instanceof Node) {
Node n = (Node) s;
for (Spatial spatial : n.getChildren()) {
dumpScene(spatial, indent + 1);
}
}
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
private void dumpScene(Spatial s, int indent) {
System.err.println(indentString.substring(0, indent) + s.getName() + " (" + s.getClass().getSimpleName() + ") / " +
s.getLocalTransform().getTranslation().toString() + ", " +
s.getLocalTransform().getRotation().toString() + ", " +
s.getLocalTransform().getScale().toString());
if (s instanceof Node) {
Node n = (Node) s;
for (Spatial spatial : n.getChildren()) {
dumpScene(spatial, indent + 1);
}
}
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* Calculate the correct transform for a collision shape relative to the
* ancestor for which the shape was generated.
*
* @param spat
* @param parent
* @return a new instance (not null)
*/
private static Transform getTransform(Spatial spat, Spatial parent) {
Transform shapeTransform = new Transform();
Spatial parentNode = spat.getParent() != null ? spat.getParent() : spat;
Spatial currentSpatial = spat;
//if we have parents combine their transforms
while (parentNode != null) {
if (parent == currentSpatial) {
//real parent -> only apply scale, not transform
Transform trans = new Transform();
trans.setScale(currentSpatial.getLocalScale());
shapeTransform.combineWithParent(trans);
parentNode = null;
} else {
shapeTransform.combineWithParent(currentSpatial.getLocalTransform());
parentNode = currentSpatial.getParent();
currentSpatial = parentNode;
}
}
return shapeTransform;
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* Calculate the correct transform for a collision shape relative to the
* ancestor for which the shape was generated.
*
* @param spat
* @param parent
* @return a new instance (not null)
*/
private static Transform getTransform(Spatial spat, Spatial parent) {
Transform shapeTransform = new Transform();
Spatial parentNode = spat.getParent() != null ? spat.getParent() : spat;
Spatial currentSpatial = spat;
//if we have parents combine their transforms
while (parentNode != null) {
if (parent == currentSpatial) {
//real parent -> only apply scale, not transform
Transform trans = new Transform();
trans.setScale(currentSpatial.getLocalScale());
shapeTransform.combineWithParent(trans);
parentNode = null;
} else {
shapeTransform.combineWithParent(currentSpatial.getLocalTransform());
parentNode = currentSpatial.getParent();
currentSpatial = parentNode;
}
}
return shapeTransform;
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
Transform localTransform = loopSpatial.getLocalTransform();
combined.combineWithParent(localTransform);
loopSpatial = loopSpatial.getParent();
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
vTrack.setTransform(frame, spatial.getLocalTransform());
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
Transform localTransform = loopSpatial.getLocalTransform();
combined.combineWithParent(localTransform);
loopSpatial = loopSpatial.getParent();
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
switch (space) {
case CONSTRAINT_SPACE_LOCAL:
return feature.getLocalTransform();
case CONSTRAINT_SPACE_WORLD:
return feature.getWorldTransform();
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
switch (space) {
case CONSTRAINT_SPACE_LOCAL:
feature.getLocalTransform().set(transform);
break;
case CONSTRAINT_SPACE_WORLD:
代码示例来源:origin: us.ihmc/IHMCJMonkeyEngineToolkit
public static void printSubmeshes(Spatial spatial)
{
System.out.println(spatial.getName() + " " + spatial.getLocalTransform());
// spatial.setLocalTranslation(spatial.getLocalTranslation().mult(0.5f));
if (spatial instanceof Node)
{
List<Spatial> spatials = ((Node) spatial).getChildren();
for (Spatial child : spatials)
{
printSubmeshes(child);
}
}
}
代码示例来源:origin: us.ihmc/ihmc-jmonkey-engine-toolkit
public static void printSubmeshes(Spatial spatial)
{
System.out.println(spatial.getName() + " " + spatial.getLocalTransform());
// spatial.setLocalTranslation(spatial.getLocalTranslation().mult(0.5f));
if (spatial instanceof Node)
{
List<Spatial> spatials = ((Node) spatial).getChildren();
for (Spatial child : spatials)
{
printSubmeshes(child);
}
}
}
代码示例来源:origin: org.jmonkeyengine/jme3-bullet
/**
* returns the correct transform for a collisionshape in relation
* to the ancestor for which the collisionshape is generated
* @param spat
* @param parent
* @return
*/
private static Transform getTransform(Spatial spat, Spatial parent) {
Transform shapeTransform = new Transform();
Spatial parentNode = spat.getParent() != null ? spat.getParent() : spat;
Spatial currentSpatial = spat;
//if we have parents combine their transforms
while (parentNode != null) {
if (parent == currentSpatial) {
//real parent -> only apply scale, not transform
Transform trans = new Transform();
trans.setScale(currentSpatial.getLocalScale());
shapeTransform.combineWithParent(trans);
parentNode = null;
} else {
shapeTransform.combineWithParent(currentSpatial.getLocalTransform());
parentNode = currentSpatial.getParent();
currentSpatial = parentNode;
}
}
return shapeTransform;
}
代码示例来源:origin: org.jmonkeyengine/jme3-jbullet
/**
* Calculate the correct transform for a collision shape relative to the
* ancestor for which the shape was generated.
*
* @param spat
* @param parent
* @return a new instance (not null)
*/
private static Transform getTransform(Spatial spat, Spatial parent) {
Transform shapeTransform = new Transform();
Spatial parentNode = spat.getParent() != null ? spat.getParent() : spat;
Spatial currentSpatial = spat;
//if we have parents combine their transforms
while (parentNode != null) {
if (parent == currentSpatial) {
//real parent -> only apply scale, not transform
Transform trans = new Transform();
trans.setScale(currentSpatial.getLocalScale());
shapeTransform.combineWithParent(trans);
parentNode = null;
} else {
shapeTransform.combineWithParent(currentSpatial.getLocalTransform());
parentNode = currentSpatial.getParent();
currentSpatial = parentNode;
}
}
return shapeTransform;
}
代码示例来源:origin: org.jmonkeyengine/jme3-core
/**
* Update the local transform of the attachments node.
*/
private void updateAttachNode() {
Node attachParent = attachNode.getParent();
if (attachParent == null || targetGeometry == null
|| targetGeometry.getParent() == attachParent
&& targetGeometry.getLocalTransform().isIdentity()) {
/*
* The animated meshes are in the same coordinate system as the
* attachments node: no further transforms are needed.
*/
attachNode.setLocalTranslation(modelPos);
attachNode.setLocalRotation(modelRot);
attachNode.setLocalScale(modelScale);
} else {
Spatial loopSpatial = targetGeometry;
Transform combined = new Transform(modelPos, modelRot, modelScale);
/*
* Climb the scene graph applying local transforms until the
* attachments node's parent is reached.
*/
while (loopSpatial != attachParent && loopSpatial != null) {
Transform localTransform = loopSpatial.getLocalTransform();
combined.combineWithParent(localTransform);
loopSpatial = loopSpatial.getParent();
}
attachNode.setLocalTransform(combined);
}
}
代码示例来源:origin: us.ihmc/ihmc-jmonkey-engine-toolkit
subchild.setLocalTransform(child.getLocalTransform());
代码示例来源:origin: us.ihmc/IHMCJMonkeyEngineToolkit
subchild.setLocalTransform(child.getLocalTransform());
内容来源于网络,如有侵权,请联系作者删除!