Package com.jme.math

Examples of com.jme.math.Vector3f


     * @return
     */
    public Iterable<Space> getEnclosingSpace(BoundingVolume volume) {
        ArrayList retList = new ArrayList();

        Vector3f point = volume.getCenter();

        float xf = ((point.x+SPACE_SIZE) / (SPACE_SIZE*2));
        float yf = ((point.y+SPACE_SIZE) / (SPACE_SIZE*2));
        float zf = ((point.z+SPACE_SIZE) / (SPACE_SIZE*2));

 
View Full Code Here


        return retList;
    }

    private Space createSpace(int x, int y, int z) {
       
        Vector3f center = new Vector3f(((x) * SPACE_SIZE*2),
                                       ((y) * SPACE_SIZE*2),
                                       ((z) * SPACE_SIZE*2));
        BoundingBox gridBounds = new BoundingBox(center,
                                                 SPACE_SIZE,
                                                 SPACE_SIZE,
View Full Code Here

        float distance = CellPlacementUtils.getDistance(bv, fov, min, max);
       
        // calculate the look vector to this cell -- we only care about the y axis
        // rotation
        Quaternion rotation = cell.getWorldTransform().getRotation(null);
        Vector3f lookVec = CellPlacementUtils.getLookDirection(rotation, null);

        // translate into a quaternion using lookAt
        Quaternion look = new Quaternion();
        look.lookAt(lookVec.negate(), Vector3f.UNIT_Y);

        // find the origin by translating the look vector
        Vector3f origin = lookVec.mult(distance);
        origin.addLocal(cell.getWorldTransform().getTranslation(null));
        return new CellTransform(look, origin);
    }
View Full Code Here

        // go to the given cell
        CellTransform origin = getGotoLocation(selectedCell);
       
        // adjust the height so the export is relative to the avatar's current
        // height
        Vector3f translation = origin.getTranslation(null);
        CellTransform avatarTransform = ViewManager.getViewManager().getPrimaryViewCell().getWorldTransform();
        translation.y = avatarTransform.getTranslation(null).getY();
        origin.setTranslation(translation);
       
        exporter.exportCells(new Cell[] { selectedCell }, origin);      
View Full Code Here

     */
    public CellTransform getCameraTransform() {
        if (cameraNode != null) {
            return new CellTransform(cameraNode.getWorldRotation(), cameraNode.getWorldTranslation(), cameraNode.getWorldScale().x);
        }
        return new CellTransform(null, new Vector3f(0, 0, 0));
    }
View Full Code Here

     * @return The camera look direction
     */
    public Vector3f getCameraLookDirection(Vector3f v) {
        Quaternion rot = cameraNode.getWorldRotation();
        if (v == null) {
            v = new Vector3f(0, 0, 1);
        } else {
            v.set(0, 0, 1);
        }
        rot.multLocal(v);
        v.normalizeLocal();
View Full Code Here

            lastSpaceValidationPoint.distanceSquared(v3f)>REVAL_DISTANCE_SQUARED) {

            revalidateSpaces();
           
            if (lastSpaceValidationPoint==null)
                lastSpaceValidationPoint = new Vector3f(v3f);
            else
                lastSpaceValidationPoint.set(v3f);
        }

        UniverseImpl.getUniverse().scheduleTransaction(
View Full Code Here

    private ManagedReference<AvatarCellCacheMO> avatarCellCacheRef;
    private ManagedReference<UserMO> userRef;
    private WonderlandClientID clientID;

    public AvatarCellMO(UserMO user, WonderlandClientID clientID) {
        super(new BoundingSphere(AvatarBoundsHelper.AVATAR_CELL_SIZE, new Vector3f()),
              new CellTransform(null, new Vector3f())  );

        this.userRef = AppContext.getDataManager().createReference(user);
        this.clientID = clientID;

        Vector3f location = new Vector3f(0,0,0);
        Vector3f lookDirection = new Vector3f(0,0,1);

        Quaternion rotation = new Quaternion();
        rotation.lookAt(lookDirection, new Vector3f(0f,1f,0f));
        CellTransform initialLocation = new CellTransform(rotation, location);
        setLocalTransform(initialLocation);
    }
View Full Code Here

           
           
            BoundingVolume modelBounds = importedModel.getModelBG().getWorldBound();
            float scale = scaleBounds(modelBounds);
            modelBounds = modelBounds.transform(new Quaternion(), Vector3f.ZERO,
                                                new Vector3f(scale, scale, scale));
           
            cellSetup.setBoundingVolumeHint(new BoundingVolumeHint(false, modelBounds));
            deployedModel.setModelBounds(modelBounds);

            Vector3f offset = importedModel.getRootBG().getLocalTranslation();
            PositionComponentServerState position = new PositionComponentServerState();
            Vector3f boundsCenter = modelBounds.getCenter();

            offset.subtractLocal(boundsCenter);
            deployedModel.setModelTranslation(offset);
            deployedModel.setModelRotation(importedModel.getModelBG().getLocalRotation());
            deployedModel.setModelScale(importedModel.getModelBG().getLocalScale().multLocal(scale));

//            System.err.println("BOUNDS CENTER "+boundsCenter);
//            System.err.println("OFfset "+offset);
//            System.err.println("Cell origin "+boundsCenter);
            position.setTranslation(boundsCenter);

            // The cell bounds already have the rotation and scale applied, so these
            // values must not go in the Cell transform. Instead they go in the
            // deployedModel so that the model is correctly oriented and thus
            // matches the bounds in the cell.

            // Center the worldBounds on the cell (ie 0,0,0)
            BoundingVolume worldBounds = modelBounds.clone(null);
            worldBounds.setCenter(new Vector3f(0,0,0));
            position.setBounds(worldBounds);
            cellSetup.addComponentServerState(position);

            deployedModel.addCellServerState(cellSetup);
View Full Code Here

    private void updateTranslation() {
        float x = (Float) xTranslationModel.getValue();
        float y = (Float) yTranslationModel.getValue();
        float z = (Float) zTranslationModel.getValue();

        Vector3f translation = new Vector3f(x, y, z);
        if (movableComponent != null) {
            CellTransform cellTransform = selectedCell.getLocalTransform();
            cellTransform.setTranslation(translation);
            movableComponent.localMoveRequest(cellTransform);
        }
View Full Code Here

TOP

Related Classes of com.jme.math.Vector3f

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.