From 40be1b42b88b094bdc2ea4753ec278c1f0c9827b Mon Sep 17 00:00:00 2001 From: Stephen Gold Date: Fri, 26 Apr 2019 10:20:08 -0700 Subject: [PATCH] DynamicAnimControl: remove all mention of attachments incl. isReleased() --- .../bullet/animation/DacConfiguration.java | 3 +- .../com/jme3/bullet/animation/DacLinks.java | 3 +- .../bullet/animation/DynamicAnimControl.java | 55 ++++++++----------- .../jme3/bullet/animation/PhysicsLink.java | 13 +---- 4 files changed, 28 insertions(+), 46 deletions(-) diff --git a/jme3-bullet/src/common/java/com/jme3/bullet/animation/DacConfiguration.java b/jme3-bullet/src/common/java/com/jme3/bullet/animation/DacConfiguration.java index d5b46d6cb..ea03107b6 100644 --- a/jme3-bullet/src/common/java/com/jme3/bullet/animation/DacConfiguration.java +++ b/jme3-bullet/src/common/java/com/jme3/bullet/animation/DacConfiguration.java @@ -107,8 +107,7 @@ abstract public class DacConfiguration extends AbstractPhysicsControl { // constructors /** - * Instantiate an enabled control without any attachments or linked bones - * (torso only). + * Instantiate an enabled control without any linked bones (torso only). */ DacConfiguration() { } diff --git a/jme3-bullet/src/common/java/com/jme3/bullet/animation/DacLinks.java b/jme3-bullet/src/common/java/com/jme3/bullet/animation/DacLinks.java index 42dd09775..d80adc4a2 100644 --- a/jme3-bullet/src/common/java/com/jme3/bullet/animation/DacLinks.java +++ b/jme3-bullet/src/common/java/com/jme3/bullet/animation/DacLinks.java @@ -127,8 +127,7 @@ public class DacLinks // constructors /** - * Instantiate an enabled control without any linked bones or attachments - * (torso only). + * Instantiate an enabled control without any linked bones (torso only). */ DacLinks() { } diff --git a/jme3-bullet/src/common/java/com/jme3/bullet/animation/DynamicAnimControl.java b/jme3-bullet/src/common/java/com/jme3/bullet/animation/DynamicAnimControl.java index adead3c12..7ae598f0b 100644 --- a/jme3-bullet/src/common/java/com/jme3/bullet/animation/DynamicAnimControl.java +++ b/jme3-bullet/src/common/java/com/jme3/bullet/animation/DynamicAnimControl.java @@ -85,7 +85,7 @@ public class DynamicAnimControl // fields /** - * calculated total mass, not including released attachments + * calculated total mass */ private float ragdollMass = 0f; /** @@ -105,8 +105,7 @@ public class DynamicAnimControl // constructors /** - * Instantiate an enabled control without any linked bones or attachments - * (torso only). + * Instantiate an enabled control without any linked bones (torso only). */ public DynamicAnimControl() { } @@ -160,8 +159,7 @@ public class DynamicAnimControl } /** - * Calculate the ragdoll's total mass and center of mass, excluding released - * attachments. + * Calculate the ragdoll's total mass and center of mass. *

* Allowed only when the control IS added to a spatial. * @@ -187,7 +185,7 @@ public class DynamicAnimControl /** * Alter the contact-response setting of the specified link and all its - * descendants (excluding released attachments). Note: recursive! + * descendants. Note: recursive! *

* Allowed only when the control IS added to a spatial. * @@ -199,14 +197,12 @@ public class DynamicAnimControl boolean desiredResponse) { verifyAddedToSpatial("change modes"); - if (!rootLink.isReleased()) { - PhysicsRigidBody rigidBody = rootLink.getRigidBody(); - rigidBody.setContactResponse(desiredResponse); + PhysicsRigidBody rigidBody = rootLink.getRigidBody(); + rigidBody.setContactResponse(desiredResponse); - PhysicsLink[] children = rootLink.listChildren(); - for (PhysicsLink child : children) { - setContactResponseSubtree(child, desiredResponse); - } + PhysicsLink[] children = rootLink.listChildren(); + for (PhysicsLink child : children) { + setContactResponseSubtree(child, desiredResponse); } } @@ -240,8 +236,8 @@ public class DynamicAnimControl } /** - * Immediately put the specified link and all its descendants (excluding - * released attachments) into dynamic mode. Note: recursive! + * Immediately put the specified link and all its descendants into dynamic + * mode. Note: recursive! *

* Allowed only when the control IS added to a spatial. * @@ -503,9 +499,8 @@ public class DynamicAnimControl } /** - * Recalculate the total mass of the ragdoll, not including released - * attachments. Also updates the location and estimated velocity of the - * center of mass. + * Recalculate the total mass of the ragdoll. Also updates the location and + * estimated velocity of the center of mass. */ private void recalculateCenter() { double massSum = 0.0; @@ -514,19 +509,17 @@ public class DynamicAnimControl Vector3f tmpVector = new Vector3f(); List links = listLinks(PhysicsLink.class); for (PhysicsLink link : links) { - if (!link.isReleased()) { - PhysicsRigidBody rigidBody = link.getRigidBody(); - float mass = rigidBody.getMass(); - massSum += mass; - - rigidBody.getPhysicsLocation(tmpVector); - tmpVector.multLocal(mass); - locationSum.addLocal(tmpVector); - - link.velocity(tmpVector); - tmpVector.multLocal(mass); - velocitySum.addLocal(tmpVector); - } + PhysicsRigidBody rigidBody = link.getRigidBody(); + float mass = rigidBody.getMass(); + massSum += mass; + + rigidBody.getPhysicsLocation(tmpVector); + tmpVector.multLocal(mass); + locationSum.addLocal(tmpVector); + + link.velocity(tmpVector); + tmpVector.multLocal(mass); + velocitySum.addLocal(tmpVector); } float invMass = (float) (1.0 / massSum); diff --git a/jme3-bullet/src/common/java/com/jme3/bullet/animation/PhysicsLink.java b/jme3-bullet/src/common/java/com/jme3/bullet/animation/PhysicsLink.java index e9633263f..22ed5a4da 100644 --- a/jme3-bullet/src/common/java/com/jme3/bullet/animation/PhysicsLink.java +++ b/jme3-bullet/src/common/java/com/jme3/bullet/animation/PhysicsLink.java @@ -52,8 +52,8 @@ import java.util.logging.Logger; /** * The abstract base class used by DynamicAnimControl to link pieces of a JME * model to their corresponding collision objects in a ragdoll. Subclasses - * include: AttachmentLink, BoneLink, and TorsoLink. The links in each - * DynamicAnimControl form a hierarchy with the TorsoLink at its root. + * include BoneLink and TorsoLink. The links in each DynamicAnimControl form a + * hierarchy with the TorsoLink at its root. *

* This class is shared between JBullet and Native Bullet. * @@ -248,15 +248,6 @@ abstract public class PhysicsLink } } - /** - * Test whether the attached model (if any) has been released. - * - * @return false unless this is an AttachmentLink - */ - public boolean isReleased() { - return false; - } - /** * Read the kinematic weight of this link. *