From c96d5df01b431742f88fc6b6618fc9f1f9fea01a Mon Sep 17 00:00:00 2001 From: Jesse Morgan Date: Sat, 5 Mar 2011 22:07:10 +0000 Subject: Added copy constructor to collidableobject so that any collidableobject could become a physical object. --- src/common/CollidableObject.java | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src/common') diff --git a/src/common/CollidableObject.java b/src/common/CollidableObject.java index 4c04281..5ec49f3 100644 --- a/src/common/CollidableObject.java +++ b/src/common/CollidableObject.java @@ -38,6 +38,36 @@ public abstract class CollidableObject implements Serializable { // The inverse inertia tensor in world coordinates transient private Matrix3f inverseInertiaTensorCache; + /** + * Copy Constructor + * @param The CollidableObject to copy. + */ + protected CollidableObject(CollidableObject o) { + inverseMass = o.inverseMass; + centerOfMass = o.centerOfMass; + position = o.position; + previousPosition = o.previousPosition; + velocity = o.velocity; + previousVelocity = o.previousVelocity; + forceAccumulator = o.forceAccumulator; + orientation = o.orientation; + angularVelocity = o.angularVelocity; + previousRotationalVelocity = o.previousRotationalVelocity; + torqueAccumulator = o.torqueAccumulator; + inverseInertiaTensor = o.inverseInertiaTensor; + coefficientOfRestitution = o.coefficientOfRestitution; + penetrationCorrection = o.penetrationCorrection; + dynamicFriction = o.dynamicFriction; + rotationalFriction = o.rotationalFriction; + BG = o.BG; + TG = o.TG; + node = o.node; + vertexCache = o.vertexCache; + triangleCache = o.triangleCache; + boundsCache = o.boundsCache; + inverseInertiaTensorCache = o.inverseInertiaTensorCache; + } + public CollidableObject() { this(1); } -- cgit v1.2.3