summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorJesse Morgan <jesse@jesterpm.net>2011-03-05 22:07:10 +0000
committerJesse Morgan <jesse@jesterpm.net>2011-03-05 22:07:10 +0000
commitc96d5df01b431742f88fc6b6618fc9f1f9fea01a (patch)
treeba3e4bb7c53d5ff722aa7ff0af5ac64aeab8b6c1 /src/common
parent1a7bbcdb8b68631219d171f0953d80436a4b2fcc (diff)
Added copy constructor to collidableobject so that any collidableobject could become a physical object.
Diffstat (limited to 'src/common')
-rw-r--r--src/common/CollidableObject.java30
1 files changed, 30 insertions, 0 deletions
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);
}