Buggy code:
bc . addBehavior ( new org . jtrfp . trcl . beh . CubeCollisionBehavior ( bc ) ) ; add ( bc ) ; break ; case wallUpSTUB : case wallUp : bc = new BarrierCube ( tr , tunnelDia , tunnelDia , wallThickness , tunnelTexturePalette [ s . getObstacleTextureIndex ( ) ] , new double [ ] { ( tunnelDia ) // 2.0 , ( tunnelDia ) // 2.0 , 0 } , false ) ; bc . setPosition ( wPos . add ( top . scalarMultiply ( ( ( tunnelDia ) // 2 ) ) ) . toArray ( ) ) ; bc . setHeading ( heading ) ; bc . setTop ( top ) ; bc . addBehavior ( new org . jtrfp . trcl . beh . CubeCollisionBehavior ( bc ) ) ; add ( bc ) ; break ; case rotatingHalfWall : { final double rotPeriod = 32768.0 // ( ( double ) ( s . getRotationSpeed ( ) ) ) ; final boolean rotate = ! ( Double . isInfinite ( rotPeriod ) ) ; bc = new BarrierCube ( tr , tunnelDia , tunnelDia , wallThickness , tunnelTexturePalette [ s . getObstacleTextureIndex ( ) ] , new double [ ] { 0 , ( tunnelDia ) // 2.0 , 0 } , false ) ; if ( rotate ) { bc . addBehavior ( new org . jtrfp . trcl . beh . phy . RotatingObjectBehavior ( heading , heading , top , ( ( int ) ( rotPeriod * 1000.0 ) ) , 0 ) ) ; bc . setTop ( top ) ; } else bc . setTop ( new org . apache . commons . math3 . geometry . euclidean . threed . Rotation ( heading , ( ( Math . PI ) + ( ( Math . PI ) // 2 ) ) ) . applyTo ( top ) ) ; bc . setPosition ( wPos . toArray ( ) ) ; bc . setHeading ( heading ) ; bc . setTop ( top ) ; bc . addBehavior ( new org . jtrfp . trcl . beh . CubeCollisionBehavior ( bc ) ) ; add ( bc ) ; break ; } case rotating34Wall : { final double rotPeriod = 32768.0 // ( ( double ) ( s . getRotationSpeed ( ) ) ) ; final boolean rotate = ! ( Double . isInfinite ( rotPeriod ) ) ; bc = new BarrierCube ( tr , tunnelDia , tunnelDia , wallThickness , tunnelTexturePalette [ s . getObstacleTextureIndex ( ) ] , new double [ ] { 0 , ( tunnelDia ) // 2.0 , 10 } , false ) ; if ( rotate ) { bc . addBehavior ( new org . jtrfp . trcl . beh . phy . RotatingObjectBehavior ( heading , heading , top , ( ( int ) ( rotPeriod * 1000.0 ) ) , Math . PI ) ) ; bc . setTop ( top ) ; } else bc . setTop ( new org . apache . commons . math3 . geometry . euclidean . threed . Rotation ( heading , ( ( Math . PI ) + ( ( Math . PI ) // 2 ) ) ) . applyTo ( top ) ) ; bc . setPosition ( wPos . toArray ( ) ) ; bc . setHeading ( heading ) ; bc . addBehavior ( new org . jtrfp . trcl . beh . CubeCollisionBehavior ( bc ) ) ; add ( bc ) ; bc = new BarrierCube ( tr , tunnelDia , tunnelDia , wallThickness , tunnelTexturePalette [ s . getObstacleTextureIndex ( ) ] , new double [ ] { 0 , ( tunnelDia ) // 2.0 , 0 } , false ) ; if ( rotate ) { <START_BUG> bc . addBehavior ( new org . jtrfp . trcl . beh . phy . RotatingObjectBehavior ( heading , heading , top , ( ( int ) ( rotPeriod ) ) , ( ( Math . PI ) + ( ( Math . PI ) // 2 ) ) ) ) ; <END_BUG> bc . setTop ( top ) ; } else bc . setTop ( new org . apache . commons . math3 . geometry . euclidean . threed . Rotation ( heading , ( ( Math . PI ) * 2 ) ) . applyTo ( top ) ) ; bc . setPosition ( wPos . add ( new Vector3D ( 100 , 0 , 0 ) ) . toArray ( ) ) ; bc . setHeading ( heading ) ; bc . addBehavior ( new org . jtrfp . trcl . beh . CubeCollisionBehavior ( bc ) ) ; add ( bc ) ; break ; } case fan : wo = new WorldObject ( tr , tr . getResourceManager ( ) . getBINModel ( "BLADE.BIN" , tunnelTexturePalette [ s . getObstacleTextureIndex ( ) ] , 28 , false , palette ) ) ; wo . setPosition ( wPos . toArray ( ) ) ; wo . setHeading ( heading ) ; wo . setTop ( top ) ; wo . addBehavior ( new org . jtrfp . trcl . beh . CubeCollisionBehavior ( wo ) ) ; wo . addBehavior ( new org . jtrfp . trcl . beh . phy . RotatingObjectBehavior ( heading , heading , top , 6000 , ( ( ( Math . random ( ) ) * 2 ) * ( Math . PI ) ) ) ) ; add ( wo ) ; wo = new WorldObject ( tr , tr . getResourceManager ( ) . getBINModel ( "FANBODY.BIN" , tunnelTexturePalette [ s . getObstacleTextureIndex ( ) ] , 28 , false , palette ) ) ; wo . setPosition ( wPos . toArray ( ) ) ; wo . setHeading ( heading ) ; wo . setTop ( top ) ;

Fix:
bc . addBehavior ( new org . jtrfp . trcl . beh . phy . RotatingObjectBehavior ( heading , heading , top , ( ( int ) ( rotPeriod * 1000.0 ) ) , ( ( Math . PI ) + ( ( Math . PI ) // 2 ) ) ) ) ;