Search in sources :

Example 91 with Spatial

use of com.jme3.scene.Spatial in project jmonkeyengine by jMonkeyEngine.

the class BulletJointDebugControl method setSpatial.

@Override
public void setSpatial(Spatial spatial) {
    if (spatial != null && spatial instanceof Node) {
        Node node = (Node) spatial;
        node.attachChild(geomA);
        node.attachChild(geomB);
    } else if (spatial == null && this.spatial != null) {
        Node node = (Node) this.spatial;
        node.detachChild(geomA);
        node.detachChild(geomB);
    }
    super.setSpatial(spatial);
}
Also used : Node(com.jme3.scene.Node)

Example 92 with Spatial

use of com.jme3.scene.Spatial in project jmonkeyengine by jMonkeyEngine.

the class BulletRigidBodyDebugControl method setSpatial.

@Override
public void setSpatial(Spatial spatial) {
    if (spatial != null && spatial instanceof Node) {
        Node node = (Node) spatial;
        node.attachChild(geom);
    } else if (spatial == null && this.spatial != null) {
        Node node = (Node) this.spatial;
        node.detachChild(geom);
    }
    super.setSpatial(spatial);
}
Also used : Node(com.jme3.scene.Node)

Example 93 with Spatial

use of com.jme3.scene.Spatial in project jmonkeyengine by jMonkeyEngine.

the class BulletVehicleDebugControl method setSpatial.

@Override
public void setSpatial(Spatial spatial) {
    if (spatial != null && spatial instanceof Node) {
        Node node = (Node) spatial;
        node.attachChild(suspensionNode);
    } else if (spatial == null && this.spatial != null) {
        Node node = (Node) this.spatial;
        node.detachChild(suspensionNode);
    }
    super.setSpatial(spatial);
}
Also used : Node(com.jme3.scene.Node)

Example 94 with Spatial

use of com.jme3.scene.Spatial in project jmonkeyengine by jMonkeyEngine.

the class CollisionShapeFactory method createSingleMeshShape.

/**
     * This type of collision shape is mesh-accurate and meant for immovable "world objects".
     * Examples include terrain, houses or whole shooter levels.<br>
     * Objects with "mesh" type collision shape will not collide with each other.
     */
private static MeshCollisionShape createSingleMeshShape(Geometry geom, Spatial parent) {
    Mesh mesh = geom.getMesh();
    Transform trans = getTransform(geom, parent);
    if (mesh != null && mesh.getMode() == Mesh.Mode.Triangles) {
        MeshCollisionShape mColl = new MeshCollisionShape(mesh);
        mColl.setScale(trans.getScale());
        return mColl;
    } else {
        return null;
    }
}
Also used : Transform(com.jme3.math.Transform)

Example 95 with Spatial

use of com.jme3.scene.Spatial in project jmonkeyengine by jMonkeyEngine.

the class CollisionShapeFactory method createSingleDynamicMeshShape.

/**
     * This method creates a hull collision shape for the given mesh.<br>
     */
private static HullCollisionShape createSingleDynamicMeshShape(Geometry geom, Spatial parent) {
    Mesh mesh = geom.getMesh();
    Transform trans = getTransform(geom, parent);
    if (mesh != null) {
        HullCollisionShape dynamicShape = new HullCollisionShape(mesh);
        dynamicShape.setScale(trans.getScale());
        return dynamicShape;
    } else {
        return null;
    }
}
Also used : Transform(com.jme3.math.Transform)

Aggregations

Spatial (com.jme3.scene.Spatial)123 Vector3f (com.jme3.math.Vector3f)74 Node (com.jme3.scene.Node)56 Geometry (com.jme3.scene.Geometry)50 DirectionalLight (com.jme3.light.DirectionalLight)46 Material (com.jme3.material.Material)39 Quaternion (com.jme3.math.Quaternion)34 FilterPostProcessor (com.jme3.post.FilterPostProcessor)17 Box (com.jme3.scene.shape.Box)17 KeyTrigger (com.jme3.input.controls.KeyTrigger)15 AmbientLight (com.jme3.light.AmbientLight)14 ColorRGBA (com.jme3.math.ColorRGBA)14 Camera (com.jme3.renderer.Camera)13 Sphere (com.jme3.scene.shape.Sphere)13 Texture (com.jme3.texture.Texture)12 TempVars (com.jme3.util.TempVars)12 InputCapsule (com.jme3.export.InputCapsule)11 ActionListener (com.jme3.input.controls.ActionListener)11 AnimControl (com.jme3.animation.AnimControl)10 OutputCapsule (com.jme3.export.OutputCapsule)9