File tree Expand file tree Collapse file tree
jme3-bullet/src/main/java/com/jme3/bullet
jme3-jbullet/src/main/java/com/jme3/bullet Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -489,9 +489,10 @@ public void removeCollisionObject(PhysicsCollisionObject obj) {
489489 * @param spatial the rootnode containing the physics objects
490490 */
491491 public void addAll (Spatial spatial ) {
492+ add (spatial );
493+
492494 if (spatial .getControl (RigidBodyControl .class ) != null ) {
493495 RigidBodyControl physicsNode = spatial .getControl (RigidBodyControl .class );
494- add (physicsNode );
495496 //add joints with physicsNode as BodyA
496497 List <PhysicsJoint > joints = physicsNode .getJoints ();
497498 for (Iterator <PhysicsJoint > it1 = joints .iterator (); it1 .hasNext ();) {
@@ -501,8 +502,6 @@ public void addAll(Spatial spatial) {
501502 add (physicsJoint );
502503 }
503504 }
504- } else {
505- add (spatial );
506505 }
507506 //recursion
508507 if (spatial instanceof Node ) {
@@ -531,10 +530,9 @@ public void removeAll(Spatial spatial) {
531530 //remove(physicsJoint.getBodyB());
532531 }
533532 }
534- remove (physicsNode );
535- } else if (spatial .getControl (PhysicsControl .class ) != null ) {
536- remove (spatial );
537533 }
534+
535+ remove (spatial );
538536 //recursion
539537 if (spatial instanceof Node ) {
540538 List <Spatial > children = ((Node ) spatial ).getChildren ();
Original file line number Diff line number Diff line change @@ -458,9 +458,10 @@ public void removeCollisionObject(PhysicsCollisionObject obj) {
458458 * @param spatial the rootnode containing the physics objects
459459 */
460460 public void addAll (Spatial spatial ) {
461+ add (spatial );
462+
461463 if (spatial .getControl (RigidBodyControl .class ) != null ) {
462464 RigidBodyControl physicsNode = spatial .getControl (RigidBodyControl .class );
463- add (physicsNode );
464465 //add joints with physicsNode as BodyA
465466 List <PhysicsJoint > joints = physicsNode .getJoints ();
466467 for (Iterator <PhysicsJoint > it1 = joints .iterator (); it1 .hasNext ();) {
@@ -470,8 +471,6 @@ public void addAll(Spatial spatial) {
470471 add (physicsJoint );
471472 }
472473 }
473- } else {
474- add (spatial );
475474 }
476475 //recursion
477476 if (spatial instanceof Node ) {
@@ -500,10 +499,9 @@ public void removeAll(Spatial spatial) {
500499 //remove(physicsJoint.getBodyB());
501500 }
502501 }
503- remove (physicsNode );
504- } else if (spatial .getControl (PhysicsControl .class ) != null ) {
505- remove (spatial );
506502 }
503+
504+ remove (spatial );
507505 //recursion
508506 if (spatial instanceof Node ) {
509507 List <Spatial > children = ((Node ) spatial ).getChildren ();
You can’t perform that action at this time.
0 commit comments