本文整理汇总了Java中com.jme3.math.Vector3f.normalizeLocal方法的典型用法代码示例。如果您正苦于以下问题:Java Vector3f.normalizeLocal方法的具体用法?Java Vector3f.normalizeLocal怎么用?Java Vector3f.normalizeLocal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.math.Vector3f
的用法示例。
在下文中一共展示了Vector3f.normalizeLocal方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createWindow
import com.jme3.math.Vector3f; //导入方法依赖的package包/类
public static void createWindow( MeshBuilder wood, MeshBuilder glass, Window w ) {
Vector3f along = new Vector3f( w.along );
along.normalizeLocal();
Vector3f up = new Vector3f( w.up );
up.normalizeLocal();
Vector3f norm = along.cross( up );
createWindow( wood, glass, w, along, up, norm );
}
示例2: updateModel
import com.jme3.math.Vector3f; //导入方法依赖的package包/类
/**
* Update position and rotation of a model.
*/
@JMEThread
public void updateModel() {
final AudioNode audioNode = getAudioNode();
final Node model = getModel();
if (model == null || audioNode == null) return;
final Node parent = audioNode.getParent();
if (parent != null) {
setLocalTranslation(parent.getWorldTranslation());
setLocalRotation(parent.getWorldRotation());
setLocalScale(parent.getWorldScale());
}
final Node editedNode = getEditedNode();
final LocalObjects local = LocalObjects.get();
final Vector3f positionOnCamera = local.nextVector();
positionOnCamera.set(editedNode.getWorldTranslation()).subtractLocal(camera.getLocation());
positionOnCamera.normalizeLocal();
positionOnCamera.multLocal(camera.getFrustumNear() + 0.4f);
positionOnCamera.addLocal(camera.getLocation());
model.setLocalTranslation(positionOnCamera);
model.setLocalRotation(editedNode.getLocalRotation());
}
示例3: createBalcony
import com.jme3.math.Vector3f; //导入方法依赖的package包/类
protected void createBalcony( DRectangle balc, Matrix4d to3d,
MeshBuilder mat, double _depth ) {
Point2d[] pts = balc.points();
Point3d[] ptt = new Point3d[4];
Vector3f[] ptf = new Vector3f[4];
for (int i = 0; i < 4; i++) {
ptt[i] = Pointz.to3( pts[i] );
to3d.transform( ptt[i] );
ptf[i] = Jme3z.to(ptt[i]);
}
Vector3f along = ptf[3].subtract( ptf[0] );
along.normalizeLocal();
Vector3f up = ptf[1].subtract(ptf[0]);
up.normalizeLocal();
Vector3f out = along.cross( up );
Vector3f loc = ptf[0];
float bg = 0.08f, sm = 0.03f, height = balc.heightF(),
depth = (float) _depth, width = balc.widthF(),
spacing = 0.3f, bgsm = (bg - sm) / 2;
// floor
mat.addCube(loc, up, along, out, bg, width, (float) depth );
// top railings
mat.addCube(loc.add(up.mult( height )), up, along, out, bg, bg, depth );
mat.addCube(loc.add(up.mult( height ).add(along.mult(width-bg))), up, along, out, bg, bg, depth );
mat.addCube( loc.add( up.mult( height ).add( out.mult( depth - bg ) ) ), up, along, out, bg, width, bg );
int count = (int)(depth/spacing);
// side decorations
for (int c = 0; c< count+1; c++) {
mat.addCube(loc.add(out.mult(c * spacing)).add(along.mult(bgsm)) , up, along, out, height, sm, sm );
mat.addCube(loc.add(out.mult(c * spacing)).add(along.mult(width - sm - bgsm)) , up, along, out, height, sm, sm );
}
count = (int) ( width / spacing);
spacing = (width - sm -2*bgsm) / count;
// top decorations
for (int c = 0; c< count+1; c++) {
mat.addCube(loc.add(out.mult(depth - sm-bgsm)).add(along.mult(bgsm + spacing * c)) , up, along, out, height, sm, sm);
}
}
示例4: checkAndUpdateVehicle
import com.jme3.math.Vector3f; //导入方法依赖的package包/类
private void checkAndUpdateVehicle() {
final int numWheels = body.getNumWheels();
suspensionNode.detachAllChildren();
for (int i = 0; i < numWheels; i++) {
final VehicleWheel physicsVehicleWheel = body.getWheel(i);
final Vector3f location = new Vector3f(physicsVehicleWheel.getLocation());
final Vector3f direction = new Vector3f(physicsVehicleWheel.getDirection());
direction.normalizeLocal();
final Vector3f axle = new Vector3f(physicsVehicleWheel.getAxle());
axle.normalizeLocal();
axle.multLocal(0.3f);
final float restLength = physicsVehicleWheel.getRestLength();
final float radius = physicsVehicleWheel.getRadius();
final Arrow locArrow = new Arrow(location);
final Arrow axleArrow = new Arrow(axle);
final Arrow wheelArrow = new Arrow(direction.multLocal(radius));
final Arrow dirArrow = new Arrow(direction.multLocal(restLength));
final Geometry locGeom = new Geometry("WheelLocationDebugShape" + i, locArrow);
final Geometry dirGeom = new Geometry("WheelDirectionDebugShape" + i, dirArrow);
final Geometry axleGeom = new Geometry("WheelAxleDebugShape" + i, axleArrow);
final Geometry wheelGeom = new Geometry("WheelRadiusDebugShape" + i, wheelArrow);
dirGeom.setLocalTranslation(location);
axleGeom.setLocalTranslation(location.add(direction));
wheelGeom.setLocalTranslation(location.add(direction));
locGeom.setMaterial(debugAppState.getDebugMagenta());
dirGeom.setMaterial(debugAppState.getDebugMagenta());
axleGeom.setMaterial(debugAppState.getDebugMagenta());
wheelGeom.setMaterial(debugAppState.getDebugMagenta());
suspensionNode.attachChild(locGeom);
suspensionNode.attachChild(dirGeom);
suspensionNode.attachChild(axleGeom);
suspensionNode.attachChild(wheelGeom);
}
}
示例5: controlUpdate
import com.jme3.math.Vector3f; //导入方法依赖的package包/类
@Override
protected void controlUpdate(final float tpf) {
checkAndUpdateVehicle();
for (int i = 0; i < body.getNumWheels(); i++) {
final VehicleWheel physicsVehicleWheel = body.getWheel(i);
final Vector3f location = new Vector3f(physicsVehicleWheel.getLocation());
final Vector3f direction = new Vector3f(physicsVehicleWheel.getDirection());
direction.normalizeLocal();
final Vector3f axle = new Vector3f(physicsVehicleWheel.getAxle());
axle.normalizeLocal();
axle.multLocal(0.3f);
final float restLength = physicsVehicleWheel.getRestLength();
final float radius = physicsVehicleWheel.getRadius();
final Geometry locGeom = (Geometry) suspensionNode.getChild("WheelLocationDebugShape" + i);
final Geometry dirGeom = (Geometry) suspensionNode.getChild("WheelDirectionDebugShape" + i);
final Geometry axleGeom = (Geometry) suspensionNode.getChild("WheelAxleDebugShape" + i);
final Geometry wheelGeom = (Geometry) suspensionNode.getChild("WheelRadiusDebugShape" + i);
final Arrow locArrow = (Arrow) locGeom.getMesh();
locArrow.setArrowExtent(location);
final Arrow axleArrow = (Arrow) axleGeom.getMesh();
axleArrow.setArrowExtent(axle);
final Arrow wheelArrow = (Arrow) wheelGeom.getMesh();
wheelArrow.setArrowExtent(direction.multLocal(radius));
final Arrow dirArrow = (Arrow) dirGeom.getMesh();
dirArrow.setArrowExtent(direction.multLocal(restLength));
dirGeom.setLocalTranslation(location);
axleGeom.setLocalTranslation(location.addLocal(direction));
wheelGeom.setLocalTranslation(location);
}
final Vector3f physicsLocation = body.getPhysicsLocation(physicalLocation);
final Quaternion physicsRotation = body.getPhysicsRotation(physicalRotation);
applyPhysicsTransform(physicsLocation, physicsRotation);
}