1/*
2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
4 */
5package com.jme3.bullet.collision.shapes.infos;
6
7import com.jme3.bullet.collision.shapes.BoxCollisionShape;
8import com.jme3.bullet.collision.shapes.CollisionShape;
9import com.jme3.export.*;
10import com.jme3.math.Matrix3f;
11import com.jme3.math.Vector3f;
12import java.io.IOException;
13
14/**
15 *
16 * @author normenhansen
17 */
18public class ChildCollisionShape implements Savable {
19
20    public Vector3f location;
21    public Matrix3f rotation;
22    public CollisionShape shape;
23
24    public ChildCollisionShape() {
25    }
26
27    public ChildCollisionShape(Vector3f location, Matrix3f rotation, CollisionShape shape) {
28        this.location = location;
29        this.rotation = rotation;
30        this.shape = shape;
31    }
32
33    public void write(JmeExporter ex) throws IOException {
34        OutputCapsule capsule = ex.getCapsule(this);
35        capsule.write(location, "location", new Vector3f());
36        capsule.write(rotation, "rotation", new Matrix3f());
37        capsule.write(shape, "shape", new BoxCollisionShape(new Vector3f(1, 1, 1)));
38    }
39
40    public void read(JmeImporter im) throws IOException {
41        InputCapsule capsule = im.getCapsule(this);
42        location = (Vector3f) capsule.readSavable("location", new Vector3f());
43        rotation = (Matrix3f) capsule.readSavable("rotation", new Matrix3f());
44        shape = (CollisionShape) capsule.readSavable("shape", new BoxCollisionShape(new Vector3f(1, 1, 1)));
45    }
46}
47