本文整理了Java中com.jme3.scene.Spatial.collideWith()
方法的一些代码示例,展示了Spatial.collideWith()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Spatial.collideWith()
方法的具体详情如下:
包路径:com.jme3.scene.Spatial
类名称:Spatial
方法名:collideWith
暂无
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
@Override
public int collideWith(Collidable other, CollisionResults results) {
int total = 0;
for (Spatial child : children.getArray()) {
if (!isBatch(child)) {
total += child.collideWith(other, results);
}
}
return total;
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
total += child.collideWith(other, results);
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
@Override
public int collideWith(Collidable other, CollisionResults results){
int total = 0;
if (other instanceof Ray)
return collideWithRay((Ray)other, results);
// if it didn't collide with this bbox, return
if (other instanceof BoundingVolume)
if (!this.getWorldBound().intersects((BoundingVolume)other))
return total;
for (Spatial child : children){
total += child.collideWith(other, results);
}
return total;
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public void update(){
int w = image.getWidth();
int h = image.getHeight();
float wr = (float) cam.getWidth() / image.getWidth();
float hr = (float) cam.getHeight() / image.getHeight();
scene.updateGeometricState();
for (int y = 0; y < h; y++){
for (int x = 0; x < w; x++){
Vector2f v = new Vector2f(x * wr,y * hr);
Vector3f pos = cam.getWorldCoordinates(v, 0.0f);
Vector3f dir = cam.getWorldCoordinates(v, 0.3f);
dir.subtractLocal(pos).normalizeLocal();
Ray r = new Ray(pos, dir);
results.clear();
scene.collideWith(r, results);
if (results.size() > 0){
image.setRGB(x, h - y - 1, 0xFFFFFFFF);
}else{
image.setRGB(x, h - y - 1, 0xFF000000);
}
}
}
label.repaint();
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
@Override
public void simpleUpdate(float tpf) {
CollisionResults results = new CollisionResults();
BoundingVolume bv = geom1.getWorldBound();
golem.collideWith(bv, results);
if (results.size() > 0) {
geom1.getMaterial().setColor("Color", ColorRGBA.Red);
}else{
geom1.getMaterial().setColor("Color", ColorRGBA.Blue);
}
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public int collideWith(Collidable other, CollisionResults results) {
if (other instanceof Ray) {
Ray ray = (Ray) other;
return collideWithRay(ray, results);
} else if (other instanceof Triangle){
Triangle t = (Triangle) other;
return collideWithTri(t, results);
} else if (other instanceof BoundingVolume) {
if (intersects((BoundingVolume)other)) {
CollisionResult result = new CollisionResult();
results.addCollision(result);
return 1;
}
return 0;
} else if (other instanceof Spatial) {
return ((Spatial)other).collideWith(this, results);
} else {
throw new UnsupportedCollisionException();
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
@Override
public int collideWith(Collidable other, CollisionResults results) {
if (other instanceof Ray) {
Ray ray = (Ray) other;
return collideWithRay(ray, results);
} else if (other instanceof Triangle) {
Triangle t = (Triangle) other;
if (intersects(t.get1(), t.get2(), t.get3())) {
CollisionResult r = new CollisionResult();
results.addCollision(r);
return 1;
}
return 0;
} else if (other instanceof BoundingVolume) {
if (intersects((BoundingVolume) other)) {
CollisionResult r = new CollisionResult();
results.addCollision(r);
return 1;
}
return 0;
} else if (other instanceof Spatial) {
return ((Spatial)other).collideWith(this, results);
} else {
throw new UnsupportedCollisionException("With: " + other.getClass().getSimpleName());
}
}
代码示例来源:origin: info.projectkyoto/mms-engine
public int collideWith(Collidable other, CollisionResults results){
int total = 0;
for (Spatial child : children.getArray()){
total += child.collideWith(other, results);
}
return total;
}
代码示例来源:origin: org.jmonkeyengine/jme3-core
@Override
public int collideWith(Collidable other, CollisionResults results) {
int total = 0;
for (Spatial child : children.getArray()) {
if (!isBatch(child)) {
total += child.collideWith(other, results);
}
}
return total;
}
}
代码示例来源:origin: org.jmonkeyengine/jme3-core
total += child.collideWith(other, results);
代码示例来源:origin: us.ihmc.thirdparty.jme/jme3-terrain
@Override
public int collideWith(Collidable other, CollisionResults results){
int total = 0;
if (other instanceof Ray)
return collideWithRay((Ray)other, results);
// if it didn't collide with this bbox, return
if (other instanceof BoundingVolume)
if (!this.getWorldBound().intersects((BoundingVolume)other))
return total;
for (Spatial child : children){
total += child.collideWith(other, results);
}
return total;
}
代码示例来源:origin: org.jmonkeyengine/jme3-core
public int collideWith(Collidable other, CollisionResults results) {
if (other instanceof Ray) {
Ray ray = (Ray) other;
return collideWithRay(ray, results);
} else if (other instanceof Triangle){
Triangle t = (Triangle) other;
return collideWithTri(t, results);
} else if (other instanceof BoundingVolume) {
if (intersects((BoundingVolume)other)) {
CollisionResult result = new CollisionResult();
results.addCollision(result);
return 1;
}
return 0;
} else if (other instanceof Spatial) {
return ((Spatial)other).collideWith(this, results);
} else {
throw new UnsupportedCollisionException();
}
}
代码示例来源:origin: org.jmonkeyengine/jme3-core
@Override
public int collideWith(Collidable other, CollisionResults results) {
if (other instanceof Ray) {
Ray ray = (Ray) other;
return collideWithRay(ray, results);
} else if (other instanceof Triangle) {
Triangle t = (Triangle) other;
if (intersects(t.get1(), t.get2(), t.get3())) {
CollisionResult r = new CollisionResult();
results.addCollision(r);
return 1;
}
return 0;
} else if (other instanceof BoundingVolume) {
if (intersects((BoundingVolume) other)) {
CollisionResult r = new CollisionResult();
results.addCollision(r);
return 1;
}
return 0;
} else if (other instanceof Spatial) {
return ((Spatial)other).collideWith(this, results);
} else {
throw new UnsupportedCollisionException("With: " + other.getClass().getSimpleName());
}
}
代码示例来源:origin: us.ihmc/IHMCJMonkeyEngineToolkit
((JMEGraphics3DAdapter) world.getGraphics3DAdapter()).getRenderer().getZUpNode().getChild(collisionNodeName).collideWith(ray, results);
代码示例来源:origin: jMonkeyEngine-Contributions/Lemur
int count = capture.collideWith(mouseRay, results);
CollisionResult cr = null;
if( count > 0 ) {
代码示例来源:origin: net.sf.phat/phat-devices
ColorRGBA colour = ColorRGBA.Blue;
rootNode.collideWith(ray, collisionResults);
if (collisionResults.size() > 0) {
CollisionResult cr = collisionResults.getClosestCollision();
内容来源于网络,如有侵权,请联系作者删除!