Package com.jme3.math

Examples of com.jme3.math.Transform


            blenderContext.getBoneContext(ownerOMA).is(BoneContext.CONNECTED_TO_PARENT)) {
            // location limit does not work on bones who are connected to their parent
            return;
        }
       
        Transform ownerTransform = this.getOwnerTransform(ownerSpace);
       
        Vector3f translation = ownerTransform.getTranslation();

        if ((flag & LIMIT_XMIN) != 0 && translation.x < limits[0][0]) {
            translation.x -= (translation.x - limits[0][0]) * influence;
        }
        if ((flag & LIMIT_XMAX) != 0 && translation.x > limits[0][1]) {
View Full Code Here


        }
    }
   
    @Override
    public void bake(Space ownerSpace, Space targetSpace, Transform targetTransform, float influence) {
        Transform ownerTransform = this.getOwnerTransform(ownerSpace);
       
        Vector3f scale = ownerTransform.getScale();
        if ((flag & LIMIT_XMIN) != 0 && scale.x < limits[0][0]) {
            scale.x -= (scale.x - limits[0][0]) * influence;
        }
        if ((flag & LIMIT_XMAX) != 0 && scale.x > limits[0][1]) {
            scale.x -= (scale.x - limits[0][1]) * influence;
 
View Full Code Here

            blenderContext.getBoneContext(ownerOMA).is(BoneContext.CONNECTED_TO_PARENT)) {
            // distance limit does not work on bones who are connected to their parent
            return;
        }
       
        Transform ownerTransform = this.getOwnerTransform(ownerSpace);

        Vector3f v = ownerTransform.getTranslation().subtract(targetTransform.getTranslation());
        float currentDistance = v.length();
        switch (mode) {
            case LIMITDIST_INSIDE:
                if (currentDistance >= dist) {
                    v.normalizeLocal();
                    v.multLocal(dist + (currentDistance - dist) * (1.0f - influence));
                    ownerTransform.getTranslation().set(v.addLocal(targetTransform.getTranslation()));
                }
                break;
            case LIMITDIST_ONSURFACE:
                if (currentDistance > dist) {
                    v.normalizeLocal();
                    v.multLocal(dist + (currentDistance - dist) * (1.0f - influence));
                    ownerTransform.getTranslation().set(v.addLocal(targetTransform.getTranslation()));
                } else if (currentDistance < dist) {
                    v.normalizeLocal().multLocal(dist * influence);
                    ownerTransform.getTranslation().set(targetTransform.getTranslation().add(v));
                }
                break;
            case LIMITDIST_OUTSIDE:
                if (currentDistance <= dist) {
                    v = targetTransform.getTranslation().subtract(ownerTransform.getTranslation()).normalizeLocal().multLocal(dist * influence);
                    ownerTransform.getTranslation().set(targetTransform.getTranslation().add(v));
                }
                break;
            default:
                throw new IllegalStateException("Unknown distance limit constraint mode: " + mode);
        }
View Full Code Here

        super(constraintData, ownerOMA, blenderContext);
    }

    @Override
    public void bake(Space ownerSpace, Space targetSpace, Transform targetTransform, float influence) {
        Transform ownerTransform = this.getOwnerTransform(ownerSpace);
       
        Quaternion ownerRotation = ownerTransform.getRotation();
        ownerAngles = ownerRotation.toAngles(ownerAngles);
        targetAngles = targetTransform.getRotation().toAngles(targetAngles);

        Quaternion startRotation = ownerRotation.clone();
        Quaternion offset = Quaternion.IDENTITY;
View Full Code Here

            blenderContext.getBoneContext(ownerOMA).is(BoneContext.CONNECTED_TO_PARENT)) {
            // location copy does not work on bones who are connected to their parent
            return;
        }
       
        Transform ownerTransform = this.getOwnerTransform(ownerSpace);
       
        Vector3f ownerLocation = ownerTransform.getTranslation();
        Vector3f targetLocation = targetTransform.getTranslation();

        Vector3f startLocation = ownerTransform.getTranslation().clone();
        Vector3f offset = Vector3f.ZERO;
        if ((flag & LOCLIKE_OFFSET) != 0) {// we add the original location to the copied location
            offset = startLocation;
        }
View Full Code Here

        // positions
        FloatBuffer fb = (FloatBuffer) positions.getData();
        if (posFmt != Format.Float){
            Buffer newBuf = VertexBuffer.createBuffer(posFmt, positions.getNumComponents(),
                                                      mesh.getVertexCount());
            Transform t = convertPositions(fb, bbox, newBuf);
            t.combineWithParent(geom.getLocalTransform());
            geom.setLocalTransform(t);

            VertexBuffer newPosVb = new VertexBuffer(Type.Position);
            newPosVb.setupData(positions.getUsage(),
                               positions.getNumComponents(),
View Full Code Here

                byte v3 = (byte) temp.getZ();
                bb.put(v1).put(v2).put(v3);
            }
        }

        Transform transform = new Transform();
        transform.setTranslation(offset.negate().multLocal(invScale));
        transform.setScale(invScale);
        return transform;
    }
View Full Code Here

        if (parent == null && pParent.isNotNull()) {
            Structure parentStructure = pParent.fetchData().get(0);
            parent = this.toObject(parentStructure, blenderContext);
        }

        Transform t = this.getTransformation(objectStructure, blenderContext);
        LOGGER.log(Level.FINE, "Importing object of type: {0}", objectType);
        Node result = null;
        try {
            switch (objectType) {
                case EMPTY:
View Full Code Here

        localMatrix.toTranslationVector(tempVars.vect2);
        localMatrix.toRotationQuat(tempVars.quat1);
        localMatrix.toScaleVector(tempVars.vect3);

        Transform t = new Transform(tempVars.vect2, tempVars.quat1.normalizeLocal(), tempVars.vect3.multLocal(tempVars.vect1));
        tempVars.release();
        return t;
    }
View Full Code Here

    ti.onNew(0, 0, 0);
    gestureSystem.update(1);
    ti.onRelease(0);
    gestureSystem.update(1);
    //printList(clickVectors);
    Assert.assertTrue(clickVectors.get(0).equals(new Vector2f(0,0)));
    Assert.assertTrue(zoomValues.isEmpty());
  }
View Full Code Here

TOP

Related Classes of com.jme3.math.Transform

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.