本文整理汇总了Java中com.jme3.scene.debug.Arrow类的典型用法代码示例。如果您正苦于以下问题:Java Arrow类的具体用法?Java Arrow怎么用?Java Arrow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Arrow类属于com.jme3.scene.debug包,在下文中一共展示了Arrow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: attachDebugShape
import com.jme3.scene.debug.Arrow; //导入依赖的package包/类
/**
* Creates a visual debug shape of the current collision shape of this physics object<br/>
* <b>Does not work with detached physics, please switch to PARALLEL or SEQUENTIAL for debugging</b>
* @param manager AssetManager to load the default wireframe material for the debug shape
*/
protected Spatial attachDebugShape(AssetManager manager) {
debugMaterialBlue = new Material(manager, "Common/MatDefs/Misc/Unshaded.j3md");
debugMaterialBlue.getAdditionalRenderState().setWireframe(true);
debugMaterialBlue.setColor("Color", ColorRGBA.Blue);
debugMaterialGreen = new Material(manager, "Common/MatDefs/Misc/Unshaded.j3md");
debugMaterialGreen.getAdditionalRenderState().setWireframe(true);
debugMaterialGreen.setColor("Color", ColorRGBA.Green);
debugMaterialRed = new Material(manager, "Common/MatDefs/Misc/Unshaded.j3md");
debugMaterialRed.getAdditionalRenderState().setWireframe(true);
debugMaterialRed.setColor("Color", ColorRGBA.Red);
debugMaterialYellow = new Material(manager, "Common/MatDefs/Misc/Unshaded.j3md");
debugMaterialYellow.getAdditionalRenderState().setWireframe(true);
debugMaterialYellow.setColor("Color", ColorRGBA.Yellow);
debugArrow = new Arrow(Vector3f.UNIT_XYZ);
debugArrowGeom = new Geometry("DebugArrow", debugArrow);
debugArrowGeom.setMaterial(debugMaterialGreen);
return attachDebugShape();
}
示例2: createDirectionalGizmo
import com.jme3.scene.debug.Arrow; //导入依赖的package包/类
private static Node createDirectionalGizmo(AssetManager assetManager, JmeDirectionalLight jmeLight, Light light) {
DirectionalLightGizmo gizmo = new DirectionalLightGizmo(jmeLight);
gizmo.move(0, 5, 0);
gizmo.addControl(new LightDirectionUpdate(light, gizmo));
Node billboardNode = new Node("billboard lightGizmo");
billboardNode.addControl(new BillboardControl());
billboardNode.attachChild(createLightBulb(assetManager));
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", ColorRGBA.White);
mat.getAdditionalRenderState().setLineWidth(2f);
Geometry arrow = new Geometry("direction arrow", new Arrow(((DirectionalLight) light).getDirection().mult(5f)));
arrow.setMaterial(mat);
arrow.addControl(new LightColorUpdate(light, arrow.getMaterial(), "Color"));
gizmo.attachChild(arrow);
gizmo.attachChild(billboardNode);
jmeLight.setGizmo(gizmo);
return gizmo;
}
示例3: makeUnshadedArrow
import com.jme3.scene.debug.Arrow; //导入依赖的package包/类
public Geometry makeUnshadedArrow(String name, Vector3f extents, float lineWidth, ColorRGBA color) {
Material mat = new Material(assetManager,
"Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", color);
mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
Arrow arrow = new Arrow(extents);
arrow.setLineWidth(lineWidth);
Geometry line = new Geometry(name, arrow);
line.setMaterial(mat);
line.setUserData("obj_shape", "arrow");
line.setUserData("obj_extents", extents);
line.setUserData("obj_lineWidth", lineWidth);
line.setUserData("obj_color", color);
return line;
}
示例4: addPoint
import com.jme3.scene.debug.Arrow; //导入依赖的package包/类
public void addPoint() {
Point p = new Point();
p.position = cam.getLocation().clone();
p.direction = cam.getDirection().clone();
p.rotation = cam.getRotation().clone();
p.speed = currentSpeed;
LOG.info("point added: "+p.position+" "+p.rotation);
p.sphere = new Geometry("point", sphereMesh);
p.sphere.setMaterial(sphereMat);
p.sphere.setLocalTranslation(p.position);
sceneNode.attachChild(p.sphere);
p.arrow = new Geometry("arrow", new Arrow(p.direction.mult(TerrainHeighmapCreator.TERRAIN_SCALE)));
p.arrow.getMesh().setLineWidth(4);
p.arrow.setMaterial(arrowMat);
p.arrow.setLocalTranslation(p.position);
sceneNode.attachChild(p.arrow);
points.add(p);
}
示例5: simpleUpdate
import com.jme3.scene.debug.Arrow; //导入依赖的package包/类
@Override
public void simpleUpdate(float tpf){
Vector3f intersection = getWorldIntersection();
updateHintText(intersection);
if (raiseTerrain){
if (intersection != null) {
adjustHeight(intersection, 64, tpf * 60);
}
}else if (lowerTerrain){
if (intersection != null) {
adjustHeight(intersection, 64, -tpf * 60);
}
}
if (terrain != null && intersection != null) {
float h = terrain.getHeight(new Vector2f(intersection.x, intersection.z));
Vector3f tl = terrain.getWorldTranslation();
marker.setLocalTranslation(tl.add(new Vector3f(intersection.x, h, intersection.z)) );
markerNormal.setLocalTranslation(tl.add(new Vector3f(intersection.x, h, intersection.z)) );
Vector3f normal = terrain.getNormal(new Vector2f(intersection.x, intersection.z));
((Arrow)markerNormal.getMesh()).setArrowExtent(normal);
}
}
示例6: createMarker
import com.jme3.scene.debug.Arrow; //导入依赖的package包/类
private void createMarker() {
// collision marker
Sphere sphere = new Sphere(8, 8, 0.5f);
marker = new Geometry("Marker");
marker.setMesh(sphere);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", new ColorRGBA(251f/255f, 130f/255f, 0f, 0.6f));
mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
marker.setMaterial(mat);
rootNode.attachChild(marker);
// surface normal marker
Arrow arrow = new Arrow(new Vector3f(0,1,0));
markerNormal = new Geometry("MarkerNormal");
markerNormal.setMesh(arrow);
markerNormal.setMaterial(mat);
rootNode.attachChild(markerNormal);
}
示例7: makeCoordinateAxes
import com.jme3.scene.debug.Arrow; //导入依赖的package包/类
public static Spatial makeCoordinateAxes(Vector3f pos, AssetManager assetManager){
Node b = new Node("_axis");
b.setLocalTranslation(pos);
Geometry arrow = makeShape("x", new Arrow(Vector3f.UNIT_X), ColorRGBA.Red, assetManager, true);
arrow.getMaterial().getAdditionalRenderState().setLineWidth(4); // make arrow thicker
b.attachChild(arrow);
arrow = makeShape("y", new Arrow(Vector3f.UNIT_Y), ColorRGBA.Green, assetManager, true);
arrow.getMaterial().getAdditionalRenderState().setLineWidth(4); // make arrow thicker
b.attachChild(arrow);
arrow = makeShape("z", new Arrow(Vector3f.UNIT_Z), ColorRGBA.Blue, assetManager, true);
arrow.getMaterial().getAdditionalRenderState().setLineWidth(4); // make arrow thicker
b.attachChild(arrow);
return b;
}
示例8: BulletJointDebugControl
import com.jme3.scene.debug.Arrow; //导入依赖的package包/类
public BulletJointDebugControl(BulletDebugAppState debugAppState, PhysicsJoint body) {
super(debugAppState);
this.body = body;
this.geomA = new Geometry(body.toString());
arrowA = new Arrow(Vector3f.ZERO);
geomA.setMesh(arrowA);
// geomA.setMaterial(debugAppState.DEBUG_GREEN);
this.geomB = new Geometry(body.toString());
arrowB = new Arrow(Vector3f.ZERO);
geomB.setMesh(arrowB);
// geomB.setMaterial(debugAppState.DEBUG_GREEN);
}
示例9: initMark
import com.jme3.scene.debug.Arrow; //导入依赖的package包/类
/** A red ball that marks the last spot that was "hit" by the "shot". */
protected void initMark() {
Arrow arrow = new Arrow(Vector3f.UNIT_Z.mult(2f));
arrow.setLineWidth(3);
//Sphere sphere = new Sphere(30, 30, 0.2f);
mark = new Geometry("BOOM!", arrow);
//mark = new Geometry("BOOM!", sphere);
Material mark_mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mark_mat.setColor("Color", ColorRGBA.Red);
mark.setMaterial(mark_mat);
}
示例10: getDebugShape
import com.jme3.scene.debug.Arrow; //导入依赖的package包/类
@Override
protected Spatial getDebugShape() {
//add joints
Spatial shape = super.getDebugShape();
Node node = null;
if (shape instanceof Node) {
node = (Node) shape;
} else {
node = new Node("DebugShapeNode");
node.attachChild(shape);
}
int i = 0;
for (Iterator<PhysicsJoint> it = joints.iterator(); it.hasNext();) {
PhysicsJoint physicsJoint = it.next();
Vector3f pivot = null;
if (physicsJoint.getBodyA() == this) {
pivot = physicsJoint.getPivotA();
} else {
pivot = physicsJoint.getPivotB();
}
Arrow arrow = new Arrow(pivot);
Geometry geom = new Geometry("DebugBone" + i, arrow);
geom.setMaterial(debugMaterialGreen);
node.attachChild(geom);
i++;
}
return node;
}
示例11: debugArrow
import com.jme3.scene.debug.Arrow; //导入依赖的package包/类
/**
* 显示一个箭头
* @param debugId
* @param worldOrigin
* @param worldDirection dir必须已经归一化
* @param length
*/
public static void debugArrow(String debugId, Vector3f worldOrigin, Vector3f worldDirection, float length) {
// Logger.get(DebugDynamicUtils.class).log(Level.INFO, "debugArrow, debugId={0}", debugId);
Arrow arrow = new Arrow(worldDirection);
arrow.setLineWidth(2); // make arrow thicker
Geometry s = DebugUtils.putShape(arrow, ColorRGBA.Green);
addDebugObject("debugArrow" + debugId, s, false);
TempVars tv = TempVars.get();
arrow.setArrowExtent(worldDirection.mult(length, tv.vect1));
s.setLocalTranslation(worldOrigin);
tv.release();
}
示例12: createArrow
import com.jme3.scene.debug.Arrow; //导入依赖的package包/类
public static Spatial createArrow(Vector3f start, Vector3f end, ColorRGBA color) {
Arrow arrow = new Arrow(end.subtract(start).normalizeLocal());
arrow.setLineWidth(2);
Geometry geo = putShape(arrow, color);
geo.setLocalTranslation(start);
return geo;
}
示例13: createAxisMarker
import com.jme3.scene.debug.Arrow; //导入依赖的package包/类
protected Node createAxisMarker(float arrowSize) {
Material redMat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
redMat.getAdditionalRenderState().setWireframe(true);
redMat.setColor("Color", ColorRGBA.Red);
Material greenMat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
greenMat.getAdditionalRenderState().setWireframe(true);
greenMat.setColor("Color", ColorRGBA.Green);
Material blueMat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
blueMat.getAdditionalRenderState().setWireframe(true);
blueMat.setColor("Color", ColorRGBA.Blue);
Node axis = new Node();
// create arrows
Geometry arrowX = new Geometry("arrowX", new Arrow(new Vector3f(arrowSize, 0, 0)));
arrowX.setMaterial(redMat);
Geometry arrowY = new Geometry("arrowY", new Arrow(new Vector3f(0, arrowSize, 0)));
arrowY.setMaterial(greenMat);
Geometry arrowZ = new Geometry("arrowZ", new Arrow(new Vector3f(0, 0, arrowSize)));
arrowZ.setMaterial(blueMat);
axis.attachChild(arrowX);
axis.attachChild(arrowY);
axis.attachChild(arrowZ);
//axis.setModelBound(new BoundingBox());
return axis;
}
示例14: drawArrow
import com.jme3.scene.debug.Arrow; //导入依赖的package包/类
public void drawArrow(Vector3f from, Vector3f to) {
Vector3f direction = to.subtract(from);
Arrow arrow = new Arrow(direction);
arrow.setLineWidth(4f);
Geometry g = new Geometry("arrow", arrow);
Material mat =
new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.getAdditionalRenderState().setWireframe(true);
mat.setColor("Color", ColorRGBA.Yellow);
g.setMaterial(mat);
super.spatial.getParent().attachChild(g);
g.setLocalTranslation(from);
}
示例15: pointToLocation
import com.jme3.scene.debug.Arrow; //导入依赖的package包/类
public void pointToLocation(Vector3f location) {
Vector3f from = location.clone().setY(2f);
Vector3f direction = location.subtract(from);
Arrow arrow = new Arrow(direction);
arrow.setLineWidth(6f);
Geometry g = new Geometry("arrow", arrow);
Material mat =
new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.getAdditionalRenderState().setWireframe(true);
mat.setColor("Color", ColorRGBA.Blue);
g.setMaterial(mat);
super.spatial.getParent().attachChild(g);
g.setLocalTranslation(from);
}