本文整理汇总了Java中com.jme3.collision.Collidable类的典型用法代码示例。如果您正苦于以下问题:Java Collidable类的具体用法?Java Collidable怎么用?Java Collidable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Collidable类属于com.jme3.collision包,在下文中一共展示了Collidable类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: collideWith
import com.jme3.collision.Collidable; //导入依赖的package包/类
public int collideWith(Collidable other, CollisionResults results) {
if (other instanceof BoundingVolume) {
BoundingVolume bv = (BoundingVolume) other;
return bv.collideWith(this, results);
} else if (other instanceof AbstractTriangle) {
AbstractTriangle tri = (AbstractTriangle) other;
float d = intersects(tri.get1(), tri.get2(), tri.get3());
if (Float.isInfinite(d) || Float.isNaN(d)) {
return 0;
}
Vector3f point = new Vector3f(direction).multLocal(d).addLocal(origin);
results.addCollision(new CollisionResult(point, d));
return 1;
} else {
throw new UnsupportedCollisionException();
}
}
开发者ID:mleoking,项目名称:PhET,代码行数:19,代码来源:Ray.java
示例2: collideWith
import com.jme3.collision.Collidable; //导入依赖的package包/类
@Override
public int collideWith(Collidable other, CollisionResults results) throws UnsupportedCollisionException {
if (refreshFlags != 0)
throw new IllegalStateException("Scene graph must be updated" +
" before checking collision");
if (other instanceof BoundingVolume)
if (!getWorldBound().intersects((BoundingVolume)other))
return 0;
if(other instanceof Ray)
return collideWithRay((Ray)other, results);
else if (other instanceof BoundingVolume)
return collideWithBoundingVolume((BoundingVolume)other, results);
else {
throw new UnsupportedCollisionException("TerrainPatch cannnot collide with "+other.getClass().getName());
}
}
开发者ID:mleoking,项目名称:PhET,代码行数:19,代码来源:TerrainPatch.java
示例3: collideWith
import com.jme3.collision.Collidable; //导入依赖的package包/类
@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;
}
开发者ID:mleoking,项目名称:PhET,代码行数:18,代码来源:TerrainQuad.java
示例4: collideWith
import com.jme3.collision.Collidable; //导入依赖的package包/类
public int collideWith(Collidable other, CollisionResults results) {
// Force bound to update
checkDoBoundUpdate();
// Update transform, and compute cached world matrix
computeWorldMatrix();
assert (refreshFlags & (RF_BOUND | RF_TRANSFORM)) == 0;
if (mesh != null) {
// NOTE: BIHTree in mesh already checks collision with the
// mesh's bound
int prevSize = results.size();
int added = mesh.collideWith(other, cachedWorldMat, worldBound, results);
int newSize = results.size();
for (int i = prevSize; i < newSize; i++) {
results.getCollisionDirect(i).setGeometry(this);
}
return added;
}
return 0;
}
开发者ID:mleoking,项目名称:PhET,代码行数:22,代码来源:Geometry.java
示例5: collideWith
import com.jme3.collision.Collidable; //导入依赖的package包/类
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 {
throw new UnsupportedCollisionException("With: " + other.getClass().getSimpleName());
}
}
开发者ID:mleoking,项目名称:PhET,代码行数:17,代码来源:BoundingBox.java
示例6: collideWith
import com.jme3.collision.Collidable; //导入依赖的package包/类
/**
* Handles collision detection, internal use only.
* User code should only use collideWith() on scene
* graph elements such as {@link Spatial}s.
*/
public int collideWith(Collidable other,
Matrix4f worldMatrix,
BoundingVolume worldBound,
CollisionResults results){
if (getVertexCount() == 0) {
return 0;
}
if (collisionTree == null){
createCollisionData();
}
return collisionTree.collideWith(other, worldMatrix, worldBound, results);
}
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:21,代码来源:Mesh.java
示例7: collideWith
import com.jme3.collision.Collidable; //导入依赖的package包/类
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;
float r2 = radius * radius;
float d1 = center.distanceSquared(t.get1());
float d2 = center.distanceSquared(t.get2());
float d3 = center.distanceSquared(t.get3());
if (d1 <= r2 || d2 <= r2 || d3 <= r2) {
CollisionResult r = new CollisionResult();
r.setDistance(FastMath.sqrt(Math.min(Math.min(d1, d2), d3)) - radius);
results.addCollision(r);
return 1;
}
return 0;
} else {
throw new UnsupportedCollisionException();
}
}
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:25,代码来源:BoundingSphere.java
示例8: collideWith
import com.jme3.collision.Collidable; //导入依赖的package包/类
public int collideWith(Collidable other,
Matrix4f worldMatrix,
BoundingVolume worldBound,
CollisionResults results) {
if (other instanceof Ray) {
Ray ray = (Ray) other;
return collideWithRay(ray, worldMatrix, worldBound, results);
} else if (other instanceof BoundingVolume) {
BoundingVolume bv = (BoundingVolume) other;
return collideWithBoundingVolume(bv, worldMatrix, results);
} else {
throw new UnsupportedCollisionException();
}
}
开发者ID:mleoking,项目名称:PhET,代码行数:16,代码来源:BIHTree.java
示例9: collideWith
import com.jme3.collision.Collidable; //导入依赖的package包/类
public int collideWith(Collidable other, CollisionResults results){
int total = 0;
for (Spatial child : children){
total += child.collideWith(other, results);
}
return total;
}
开发者ID:mleoking,项目名称:PhET,代码行数:8,代码来源:Node.java
示例10: collideWith
import com.jme3.collision.Collidable; //导入依赖的package包/类
/**
* Handles collision detection, internal use only.
* User code should only use collideWith() on scene
* graph elements such as {@link Spatial}s.
*/
public int collideWith(Collidable other,
Matrix4f worldMatrix,
BoundingVolume worldBound,
CollisionResults results){
if (collisionTree == null){
createCollisionData();
}
return collisionTree.collideWith(other, worldMatrix, worldBound, results);
}
开发者ID:mleoking,项目名称:PhET,代码行数:17,代码来源:Mesh.java
示例11: collideWith
import com.jme3.collision.Collidable; //导入依赖的package包/类
public int collideWith(Collidable other, CollisionResults results) {
if (other instanceof Ray) {
Ray ray = (Ray) other;
return collideWithRay(ray, results);
} else {
throw new UnsupportedCollisionException();
}
}
开发者ID:mleoking,项目名称:PhET,代码行数:9,代码来源:BoundingSphere.java
示例12: collideWith
import com.jme3.collision.Collidable; //导入依赖的package包/类
/**
* 对于不可见的UI将不进行collide检测,也就是如果当前UI visible=false,
* 则该方法始终返回0.主要为优化UI事件检测性能。
* @param other
* @param results
* @return
*/
@Override
public int collideWith(Collidable other, CollisionResults results) {
if (!this.isVisible()) {
return 0;
} else {
return super.collideWith(other, results);
}
}
开发者ID:huliqing,项目名称:LuoYing,代码行数:16,代码来源:AbstractUI.java
示例13: collideWith
import com.jme3.collision.Collidable; //导入依赖的package包/类
public int collideWith(Collidable other, CollisionResults results){
int total = 0;
for (Spatial child : children.getArray()){
total += child.collideWith(other, results);
}
return total;
}
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:8,代码来源:Node.java
示例14: collideWith
import com.jme3.collision.Collidable; //导入依赖的package包/类
public int collideWith(Collidable other,
Matrix4f worldMatrix,
BoundingVolume worldBound,
CollisionResults results);
开发者ID:mleoking,项目名称:PhET,代码行数:5,代码来源:CollisionData.java
示例15: PickEventSession
import com.jme3.collision.Collidable; //导入依赖的package包/类
protected PickEventSession( Map<Collidable, RootEntry> roots ) {
this.roots.putAll(roots);
this.rootList = null;
}
开发者ID:jMonkeyEngine-Contributions,项目名称:Lemur,代码行数:5,代码来源:PickEventSession.java
示例16: RootEntry
import com.jme3.collision.Collidable; //导入依赖的package包/类
public RootEntry( Collidable root, ViewPort viewport, String layer ) {
this.viewport = viewport;
this.root = root;
this.layer = layer;
}
开发者ID:jMonkeyEngine-Contributions,项目名称:Lemur,代码行数:6,代码来源:PickEventSession.java
示例17: collideWith
import com.jme3.collision.Collidable; //导入依赖的package包/类
@Override
public int collideWith(Collidable cldbl, CollisionResults cr) throws UnsupportedCollisionException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
开发者ID:maany,项目名称:jME-CinematicEditor,代码行数:5,代码来源:SpatialWrapper.java
示例18: collideWith
import com.jme3.collision.Collidable; //导入依赖的package包/类
public int collideWith(Collidable other, CollisionResults results) throws UnsupportedCollisionException {
return 0;
}
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:4,代码来源:BlenderKey.java
示例19: collideWith
import com.jme3.collision.Collidable; //导入依赖的package包/类
public int collideWith(Collidable other, CollisionResults results){
return other.collideWith(this, results);
}
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:4,代码来源:AbstractTriangle.java
示例20: collideWith
import com.jme3.collision.Collidable; //导入依赖的package包/类
public int collideWith(Collidable other, CollisionResults results) throws UnsupportedCollisionException {
throw new UnsupportedOperationException("Not supported yet.");
}
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:4,代码来源:BatchedGeometry.java
注:本文中的com.jme3.collision.Collidable类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论