public void updateSlots ( ) { // Find the anchor point Location < T > anchor = getAnchorPoint ( ) ; positionOffset . set ( anchor . getPosition ( ) ) ; float orientationOffset = anchor . getOrientation ( ) ; if ( motionModerator != null ) { positionOffset . sub ( driftOffset . getPosition ( ) ) ; orientationOffset -= driftOffset . getOrientation ( ) ; } // Get the orientation of the anchor point as a matrix orientationMatrix . idt ( ) . rotateRad ( anchor . getOrientation ( ) ) ; // Go through each member in turn for ( int i = 0 ; i < slotAssignments . size ; i ++ ) { SlotAssignment < T > slotAssignment = slotAssignments . get ( i ) ; // Retrieve the location reference of the formation member to calculate the new value Location < T > relativeLoc = slotAssignment . member . getTargetLocation ( ) ; // Ask for the location of the slot relative to the anchor point pattern . calculateSlotLocation ( relativeLoc , slotAssignment . slotNumber ) ; T relativeLocPosition = relativeLoc . getPosition ( ) ; // System.out.println("relativeLoc.position = " + relativeLocPosition); // [17:31] <@Xoppa> davebaol, interface Transform<T extends Vector<T>> { T getTranslation(); T getScale(); float getRotation(); // void transform(T val); } // [17:31] <@Xoppa> // https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g3d/utils/BaseAnimationController.java#L40 // [17:34] * ThreadL0ck (~ThreadL0c@197.220.114.182) Quit (Remote host closed the connection) // [17:35] <davebaol> thanks Xoppa, sounds interesting // TODO Consider the possibility of declaring mul(orientationMatrix) in Vector // Transform it by the anchor point's position and orientation // relativeLocPosition.mul(orientationMatrix).add(anchor.position); if ( relativeLocPosition instanceof Vector2 ) ( ( Vector2 ) relativeLocPosition ) . mul ( orientationMatrix ) ; else if ( relativeLocPosition instanceof Vector3 ) ( ( Vector3 ) relativeLocPosition ) . mul ( orientationMatrix ) ; // Add the anchor and drift components relativeLocPosition . add ( positionOffset ) ; relativeLoc . setOrientation ( relativeLoc . getOrientation ( ) + orientationOffset ) ; } // Possibly reset the anchor point if a moderator is set if ( motionModerator != null ) { motionModerator . updateAnchorPoint ( anchor ) ; } }
Writes new slot locations to each member