animation flickering bugfixes
	
		
			
	
		
	
	
		
	
		
			Some checks failed
		
		
	
	
		
			
				
	
				studiorailgun/Renderer/pipeline/head There was a failure building this commit
				
			
		
		
	
	
				
					
				
			
		
			Some checks failed
		
		
	
	studiorailgun/Renderer/pipeline/head There was a failure building this commit
				
			This commit is contained in:
		
							parent
							
								
									3092b70c1e
								
							
						
					
					
						commit
						8484fad7da
					
				| @ -455,6 +455,8 @@ Devtools for updating first person attachment rotations | |||||||
| (07/26/2024) | (07/26/2024) | ||||||
| Viewmodel equipped item rotates inverted to bone rotation | Viewmodel equipped item rotates inverted to bone rotation | ||||||
| Visually block | Visually block | ||||||
|  | Utility object for reducing boilerplate when writing btree transitions that just play an animation then transition | ||||||
|  | First animations flickering in first person (enforce animation priority requirement) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| # TODO | # TODO | ||||||
|  | |||||||
| @ -125,7 +125,6 @@ public class StateTransitionUtil { | |||||||
|                     if(state.audioPath != null){ |                     if(state.audioPath != null){ | ||||||
|                         Globals.virtualAudioSourceManager.createVirtualAudioSource(state.audioPath, VirtualAudioSourceType.CREATURE, false); |                         Globals.virtualAudioSourceManager.createVirtualAudioSource(state.audioPath, VirtualAudioSourceType.CREATURE, false); | ||||||
|                     } |                     } | ||||||
|                     FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, firstPersonAnimation); |  | ||||||
|                 } else { |                 } else { | ||||||
|                     //play third person audio |                     //play third person audio | ||||||
|                     if(state.audioPath != null){ |                     if(state.audioPath != null){ | ||||||
| @ -133,13 +132,16 @@ public class StateTransitionUtil { | |||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|                 actor.playAnimation(animationToPlay,1); |                 actor.playAnimation(animationToPlay,state.animPriority); | ||||||
|                 actor.incrementAnimationTime(0.0001); |                 actor.incrementAnimationTime(0.0001); | ||||||
|                 state.startedAnimation = true; |                 state.startedAnimation = true; | ||||||
|             } else if(animationToPlay == null && state.onComplete != null){ |             } else if(animationToPlay == null && state.onComplete != null){ | ||||||
|                 state.onComplete.run(); |                 state.onComplete.run(); | ||||||
|                 state.startedAnimation = false; |                 state.startedAnimation = false; | ||||||
|             } |             } | ||||||
|  |             if(firstPersonAnimation != null){ | ||||||
|  |                 FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, firstPersonAnimation, state.animPriority); | ||||||
|  |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @ -165,7 +167,7 @@ public class StateTransitionUtil { | |||||||
|                 state.startedAnimation = false; |                 state.startedAnimation = false; | ||||||
|             } else if(animationToPlay != null && (!poseActor.isPlayingAnimation() || !poseActor.isPlayingAnimation(animationToPlay))){ |             } else if(animationToPlay != null && (!poseActor.isPlayingAnimation() || !poseActor.isPlayingAnimation(animationToPlay))){ | ||||||
|                 //play animation for state |                 //play animation for state | ||||||
|                 poseActor.playAnimation(animationToPlay,1); |                 poseActor.playAnimation(animationToPlay,state.animPriority); | ||||||
|                 poseActor.incrementAnimationTime(0.0001); |                 poseActor.incrementAnimationTime(0.0001); | ||||||
|                 state.startedAnimation = true; |                 state.startedAnimation = true; | ||||||
|             } else if(animationToPlay == null && state.onComplete != null){ |             } else if(animationToPlay == null && state.onComplete != null){ | ||||||
| @ -183,6 +185,9 @@ public class StateTransitionUtil { | |||||||
|         //The enum value for this state |         //The enum value for this state | ||||||
|         Object stateEnum; |         Object stateEnum; | ||||||
| 
 | 
 | ||||||
|  |         //the priority of this animation in particular | ||||||
|  |         int animPriority; | ||||||
|  | 
 | ||||||
|         //T1he animation to play in first person |         //T1he animation to play in first person | ||||||
|         String firstPersonAnimation; |         String firstPersonAnimation; | ||||||
| 
 | 
 | ||||||
| @ -206,62 +211,22 @@ public class StateTransitionUtil { | |||||||
| 
 | 
 | ||||||
|         /** |         /** | ||||||
|          * Constructor |          * Constructor | ||||||
|          * @param stateEnum The enum value for this state |  | ||||||
|          * @param firstPersonAnimation The animation to play in first person. If this is null, it will not play any animation in first person. |  | ||||||
|          * @param thirdPersonAnimation The animation to play in third person. If this is null, it will not play any animation in third person. |  | ||||||
|          * @param audioPath The audio path to play when the animation starts. If this is null, it will not play any audio. |  | ||||||
|          * @param onComplete The function to fire on completion (ie to transition to the next state). If this is null, the animation and audio will be looped on completion. |  | ||||||
|          */ |          */ | ||||||
|         public StateTransitionUtilItem( |         private StateTransitionUtilItem( | ||||||
|             Object stateEnum, |             Object stateEnum, | ||||||
|  |             int animPriority, | ||||||
|             String firstPersonAnimation, |             String firstPersonAnimation, | ||||||
|             String thirdPersonAnimation, |  | ||||||
|             String audioPath, |  | ||||||
|             Runnable onComplete |  | ||||||
|             ){ |  | ||||||
|             this.stateEnum = stateEnum; |  | ||||||
|             this.firstPersonAnimation = firstPersonAnimation; |  | ||||||
|             this.thirdPersonAnimation = thirdPersonAnimation; |  | ||||||
|             this.audioPath = audioPath; |  | ||||||
|             this.onComplete = onComplete; |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         /** |  | ||||||
|          * Constructor |  | ||||||
|          * @param stateEnum The enum value for this state |  | ||||||
|          * @param firstPersonAnimation The animation to play in first person. If this is null, it will not play any animation in first person. |  | ||||||
|          * @param thirdPersonAnimation The animation to play in third person. If this is null, it will not play any animation in third person. |  | ||||||
|          * @param onComplete The function to fire on completion (ie to transition to the next state). If this is null, the animation and audio will be looped on completion. |  | ||||||
|          */ |  | ||||||
|         public StateTransitionUtilItem( |  | ||||||
|             Object stateEnum, |  | ||||||
|             String firstPersonAnimation, |  | ||||||
|             String thirdPersonAnimation, |  | ||||||
|             Runnable onComplete |  | ||||||
|             ){ |  | ||||||
|             this.stateEnum = stateEnum; |  | ||||||
|             this.firstPersonAnimation = firstPersonAnimation; |  | ||||||
|             this.thirdPersonAnimation = thirdPersonAnimation; |  | ||||||
|             this.onComplete = onComplete; |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         /** |  | ||||||
|          * Constructor |  | ||||||
|          * @param stateEnum The enum value for this state |  | ||||||
|          * @param firstPersonAnimation The animation to play in first person. If this is null, it will not play any animation in first person. |  | ||||||
|          * @param thirdPersonAnimation The animation to play in third person. If this is null, it will not play any animation in third person. |  | ||||||
|          * @param audioPath The audio path to play when the animation starts. If this is null, it will not play any audio. |  | ||||||
|          * @param onComplete The function to fire on completion (ie to transition to the next state). If this is null, the animation and audio will be looped on completion. |  | ||||||
|          */ |  | ||||||
|         public StateTransitionUtilItem( |  | ||||||
|             Object stateEnum, |  | ||||||
|             Supplier<String> getFirstPersonAnimation, |             Supplier<String> getFirstPersonAnimation, | ||||||
|  |             String thirdPersonAnimation, | ||||||
|             Supplier<String> getThirdPersonAnimation, |             Supplier<String> getThirdPersonAnimation, | ||||||
|             String audioPath, |             String audioPath, | ||||||
|             Runnable onComplete |             Runnable onComplete | ||||||
|             ){ |         ){ | ||||||
|             this.stateEnum = stateEnum; |             this.stateEnum = stateEnum; | ||||||
|  |             this.animPriority = animPriority; | ||||||
|  |             this.firstPersonAnimation = firstPersonAnimation; | ||||||
|             this.getFirstPersonAnimation = getFirstPersonAnimation; |             this.getFirstPersonAnimation = getFirstPersonAnimation; | ||||||
|  |             this.thirdPersonAnimation = thirdPersonAnimation; | ||||||
|             this.getThirdPersonAnimation = getThirdPersonAnimation; |             this.getThirdPersonAnimation = getThirdPersonAnimation; | ||||||
|             this.audioPath = audioPath; |             this.audioPath = audioPath; | ||||||
|             this.onComplete = onComplete; |             this.onComplete = onComplete; | ||||||
| @ -270,83 +235,195 @@ public class StateTransitionUtil { | |||||||
|         /** |         /** | ||||||
|          * Constructor |          * Constructor | ||||||
|          * @param stateEnum The enum value for this state |          * @param stateEnum The enum value for this state | ||||||
|          * @param firstPersonAnimation The animation to play in first person. If this is null, it will not play any animation in first person. |          * @param animPriority The priority of this state's animations | ||||||
|          * @param thirdPersonAnimation The animation to play in third person. If this is null, it will not play any animation in third person. |          * @param firstPersonAnimation The animation to play in first person. If this is null, it will not play any animation in first person | ||||||
|          * @param onComplete The function to fire on completion (ie to transition to the next state). If this is null, the animation and audio will be looped on completion. |          * @param getFirstPersonAnimation The supplier for a first person animation name. If it is null, it will not play any animation in first person | ||||||
|  |          * @param thirdPersonAnimation The animation to play in third person. If this is null, it will not play any animation in third person | ||||||
|  |          * @param getThirdPersonAnimation The supplier for a third person animation name. If it is null, it will not play any animation in the third person | ||||||
|  |          * @param audioPath The path to an audio file to play on starting the animation. If null, no audio will be played | ||||||
|  |          * @param onComplete !!Must transition to the next state!! Fires when the animation completes. If not supplied, animations and autio will loop | ||||||
|          */ |          */ | ||||||
|         public StateTransitionUtilItem( |         public static StateTransitionUtilItem create( | ||||||
|             Object stateEnum, |             Object stateEnum, | ||||||
|  |             int animPriority, | ||||||
|  |             String firstPersonAnimation, | ||||||
|             Supplier<String> getFirstPersonAnimation, |             Supplier<String> getFirstPersonAnimation, | ||||||
|             Supplier<String> getThirdPersonAnimation, |  | ||||||
|             Runnable onComplete |  | ||||||
|             ){ |  | ||||||
|             this.stateEnum = stateEnum; |  | ||||||
|             this.getFirstPersonAnimation = getFirstPersonAnimation; |  | ||||||
|             this.getThirdPersonAnimation = getThirdPersonAnimation; |  | ||||||
|             this.onComplete = onComplete; |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         /** |  | ||||||
|          * Constructor |  | ||||||
|          * @param stateEnum The enum value for this state |  | ||||||
|          * @param thirdPersonAnimation The animation to play in third person. If this is null, it will not play any animation in third person. |  | ||||||
|          * @param onComplete The function to fire on completion (ie to transition to the next state). If this is null, the animation and audio will be looped on completion. |  | ||||||
|          */ |  | ||||||
|         public StateTransitionUtilItem( |  | ||||||
|             Object stateEnum, |  | ||||||
|             Supplier<String> getThirdPersonAnimation, |  | ||||||
|             Runnable onComplete |  | ||||||
|             ){ |  | ||||||
|             this.stateEnum = stateEnum; |  | ||||||
|             this.getThirdPersonAnimation = getThirdPersonAnimation; |  | ||||||
|             this.onComplete = onComplete; |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         /** |  | ||||||
|          * Constructor |  | ||||||
|          * @param stateEnum The enum value for this state |  | ||||||
|          * @param firstPersonAnimation The animation to play in first person. If this is null, it will not play any animation in first person. |  | ||||||
|          * @param thirdPersonAnimation The animation to play in third person. If this is null, it will not play any animation in third person. |  | ||||||
|          */ |  | ||||||
|         public StateTransitionUtilItem( |  | ||||||
|             Object stateEnum, |  | ||||||
|             Supplier<String> getFirstPersonAnimation, |  | ||||||
|             Supplier<String> getThirdPersonAnimation |  | ||||||
|             ){ |  | ||||||
|             this.stateEnum = stateEnum; |  | ||||||
|             this.getFirstPersonAnimation = getFirstPersonAnimation; |  | ||||||
|             this.getThirdPersonAnimation = getThirdPersonAnimation; |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         /** |  | ||||||
|          * Constructor |  | ||||||
|          * @param stateEnum The enum value for this state |  | ||||||
|          * @param thirdPersonAnimation The animation to play in third person. If this is null, it will not play any animation in third person. |  | ||||||
|          */ |  | ||||||
|         public StateTransitionUtilItem( |  | ||||||
|             Object stateEnum, |  | ||||||
|             Supplier<String> getThirdPersonAnimation |  | ||||||
|             ){ |  | ||||||
|             this.stateEnum = stateEnum; |  | ||||||
|             this.getThirdPersonAnimation = getThirdPersonAnimation; |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         /** |  | ||||||
|          * Constructor |  | ||||||
|          * @param stateEnum The enum value for this state |  | ||||||
|          * @param thirdPersonAnimation The animation to play in third person. If this is null, it will not play any animation in third person. |  | ||||||
|          * @param onComplete The function to fire on completion (ie to transition to the next state). If this is null, the animation and audio will be looped on completion. |  | ||||||
|          */ |  | ||||||
|         public StateTransitionUtilItem( |  | ||||||
|             Object stateEnum, |  | ||||||
|             String thirdPersonAnimation, |             String thirdPersonAnimation, | ||||||
|  |             Supplier<String> getThirdPersonAnimation, | ||||||
|  |             String audioPath, | ||||||
|             Runnable onComplete |             Runnable onComplete | ||||||
|             ){ |             ){ | ||||||
|             this.stateEnum = stateEnum; |             return new StateTransitionUtilItem( | ||||||
|             this.thirdPersonAnimation = thirdPersonAnimation; |                 stateEnum, | ||||||
|             this.onComplete = onComplete; |                 animPriority, | ||||||
|  |                 firstPersonAnimation, | ||||||
|  |                 getFirstPersonAnimation, | ||||||
|  |                 thirdPersonAnimation, | ||||||
|  |                 getThirdPersonAnimation, | ||||||
|  |                 audioPath, | ||||||
|  |                 onComplete | ||||||
|  |             ); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         /** | ||||||
|  |          * Constructor | ||||||
|  |          * @param stateEnum The enum value for this state | ||||||
|  |          * @param animPriority The priority of this state's animations | ||||||
|  |          * @param firstPersonAnimation The animation to play in first person. If this is null, it will not play any animation in first person | ||||||
|  |          * @param thirdPersonAnimation The animation to play in third person. If this is null, it will not play any animation in third person | ||||||
|  |          * @param audioPath The path to an audio file to play on starting the animation. If null, no audio will be played | ||||||
|  |          * @param onComplete !!Must transition to the next state!! Fires when the animation completes. If not supplied, animations and autio will loop | ||||||
|  |          */ | ||||||
|  |         public static StateTransitionUtilItem create( | ||||||
|  |             Object stateEnum, | ||||||
|  |             int animPriority, | ||||||
|  |             String firstPersonAnimation, | ||||||
|  |             String thirdPersonAnimation, | ||||||
|  |             String audioPath, | ||||||
|  |             Runnable onComplete | ||||||
|  |             ){ | ||||||
|  |             return create( | ||||||
|  |                 stateEnum, | ||||||
|  |                 animPriority, | ||||||
|  |                 firstPersonAnimation, | ||||||
|  |                 null, | ||||||
|  |                 thirdPersonAnimation, | ||||||
|  |                 null, | ||||||
|  |                 audioPath, | ||||||
|  |                 onComplete | ||||||
|  |             ); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         /** | ||||||
|  |          * Constructor | ||||||
|  |          * @param stateEnum The enum value for this state | ||||||
|  |          * @param animPriority The priority of this state's animations | ||||||
|  |          * @param getFirstPersonAnimation The supplier for a first person animation name. If it is null, it will not play any animation in first person | ||||||
|  |          * @param getThirdPersonAnimation The supplier for a third person animation name. If it is null, it will not play any animation in the third person | ||||||
|  |          * @param audioPath The path to an audio file to play on starting the animation. If null, no audio will be played | ||||||
|  |          * @param onComplete !!Must transition to the next state!! Fires when the animation completes. If not supplied, animations and autio will loop | ||||||
|  |          */ | ||||||
|  |         public static StateTransitionUtilItem create( | ||||||
|  |             Object stateEnum, | ||||||
|  |             int animPriority, | ||||||
|  |             Supplier<String> getFirstPersonAnimation, | ||||||
|  |             Supplier<String> getThirdPersonAnimation, | ||||||
|  |             String audioPath, | ||||||
|  |             Runnable onComplete | ||||||
|  |             ){ | ||||||
|  |             return new StateTransitionUtilItem( | ||||||
|  |                 stateEnum, | ||||||
|  |                 animPriority, | ||||||
|  |                 null, | ||||||
|  |                 getFirstPersonAnimation, | ||||||
|  |                 null, | ||||||
|  |                 getThirdPersonAnimation, | ||||||
|  |                 audioPath, | ||||||
|  |                 onComplete | ||||||
|  |             ); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         /** | ||||||
|  |          * Constructor | ||||||
|  |          * @param stateEnum The enum value for this state | ||||||
|  |          * @param animPriority The priority of this state's animations | ||||||
|  |          * @param getFirstPersonAnimation The supplier for a first person animation name. If it is null, it will not play any animation in first person | ||||||
|  |          * @param getThirdPersonAnimation The supplier for a third person animation name. If it is null, it will not play any animation in the third person | ||||||
|  |          * @param onComplete !!Must transition to the next state!! Fires when the animation completes. If not supplied, animations and autio will loop | ||||||
|  |          */ | ||||||
|  |         public static StateTransitionUtilItem create( | ||||||
|  |             Object stateEnum, | ||||||
|  |             int animPriority, | ||||||
|  |             Supplier<String> getFirstPersonAnimation, | ||||||
|  |             Supplier<String> getThirdPersonAnimation, | ||||||
|  |             Runnable onComplete | ||||||
|  |             ){ | ||||||
|  |             return new StateTransitionUtilItem( | ||||||
|  |                 stateEnum, | ||||||
|  |                 animPriority, | ||||||
|  |                 null, | ||||||
|  |                 getFirstPersonAnimation, | ||||||
|  |                 null, | ||||||
|  |                 getThirdPersonAnimation, | ||||||
|  |                 null, | ||||||
|  |                 onComplete | ||||||
|  |             ); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         /** | ||||||
|  |          * Constructor | ||||||
|  |          * @param stateEnum The enum value for this state | ||||||
|  |          * @param animPriority The priority of this state's animations | ||||||
|  |          * @param getThirdPersonAnimation The supplier for a third person animation name. If it is null, it will not play any animation in the third person | ||||||
|  |          * @param onComplete !!Must transition to the next state!! Fires when the animation completes. If not supplied, animations and autio will loop | ||||||
|  |          */ | ||||||
|  |         public static StateTransitionUtilItem create( | ||||||
|  |             Object stateEnum, | ||||||
|  |             int animPriority, | ||||||
|  |             Supplier<String> getThirdPersonAnimation, | ||||||
|  |             Runnable onComplete | ||||||
|  |             ){ | ||||||
|  |             return new StateTransitionUtilItem( | ||||||
|  |                 stateEnum, | ||||||
|  |                 animPriority, | ||||||
|  |                 null, | ||||||
|  |                 null, | ||||||
|  |                 null, | ||||||
|  |                 getThirdPersonAnimation, | ||||||
|  |                 null, | ||||||
|  |                 onComplete | ||||||
|  |             ); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         /** | ||||||
|  |          * Constructor | ||||||
|  |          * @param stateEnum The enum value for this state | ||||||
|  |          * @param animPriority The priority of this state's animations | ||||||
|  |          * @param getThirdPersonAnimation The supplier for a third person animation name. If it is null, it will not play any animation in the third person | ||||||
|  |          */ | ||||||
|  |         public static StateTransitionUtilItem create( | ||||||
|  |             Object stateEnum, | ||||||
|  |             int animPriority, | ||||||
|  |             Supplier<String> getThirdPersonAnimation | ||||||
|  |             ){ | ||||||
|  |             return new StateTransitionUtilItem( | ||||||
|  |                 stateEnum, | ||||||
|  |                 animPriority, | ||||||
|  |                 null, | ||||||
|  |                 null, | ||||||
|  |                 null, | ||||||
|  |                 getThirdPersonAnimation, | ||||||
|  |                 null, | ||||||
|  |                 null | ||||||
|  |             ); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         /** | ||||||
|  |          * Constructor | ||||||
|  |          * @param stateEnum The enum value for this state | ||||||
|  |          * @param animPriority The priority of this state's animations | ||||||
|  |          * @param getFirstPersonAnimation The supplier for a first person animation name. If it is null, it will not play any animation in first person | ||||||
|  |          * @param getThirdPersonAnimation The supplier for a third person animation name. If it is null, it will not play any animation in the third person | ||||||
|  |          */ | ||||||
|  |         public static StateTransitionUtilItem create( | ||||||
|  |             Object stateEnum, | ||||||
|  |             int animPriority, | ||||||
|  |             Supplier<String> getFirstPersonAnimation, | ||||||
|  |             Supplier<String> getThirdPersonAnimation | ||||||
|  |             ){ | ||||||
|  |             return new StateTransitionUtilItem( | ||||||
|  |                 stateEnum, | ||||||
|  |                 animPriority, | ||||||
|  |                 null, | ||||||
|  |                 getFirstPersonAnimation, | ||||||
|  |                 null, | ||||||
|  |                 getThirdPersonAnimation, | ||||||
|  |                 null, | ||||||
|  |                 null | ||||||
|  |             ); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
|  | |||||||
| @ -0,0 +1,34 @@ | |||||||
|  | package electrosphere.entity.state; | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * The list of animation priorities | ||||||
|  |  */ | ||||||
|  | public class AnimationPriorities { | ||||||
|  |      | ||||||
|  | 
 | ||||||
|  |     // | ||||||
|  |     //2 | ||||||
|  |     // | ||||||
|  |     public static final int ATTACK = 2; | ||||||
|  |     public static final int BLOCK = 2; | ||||||
|  | 
 | ||||||
|  |     // | ||||||
|  |     //4 | ||||||
|  |     // | ||||||
|  |     public static final int FALL = 4; | ||||||
|  |     public static final int JUMP = 4; | ||||||
|  |     public static final int LAND = 4; | ||||||
|  | 
 | ||||||
|  |     // | ||||||
|  |     //5 | ||||||
|  |     // | ||||||
|  |     public static final int GROUND_MOVE = 5; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     // | ||||||
|  |     //10 | ||||||
|  |     // | ||||||
|  |     public static final int IDLE = 10; | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -8,6 +8,7 @@ import electrosphere.entity.Entity; | |||||||
| import electrosphere.entity.EntityDataStrings; | import electrosphere.entity.EntityDataStrings; | ||||||
| import electrosphere.entity.EntityUtils; | import electrosphere.entity.EntityUtils; | ||||||
| import electrosphere.entity.btree.BehaviorTree; | import electrosphere.entity.btree.BehaviorTree; | ||||||
|  | import electrosphere.entity.state.AnimationPriorities; | ||||||
| import electrosphere.entity.state.client.firstPerson.FirstPersonTree; | import electrosphere.entity.state.client.firstPerson.FirstPersonTree; | ||||||
| import electrosphere.entity.state.collidable.Impulse; | import electrosphere.entity.state.collidable.Impulse; | ||||||
| import electrosphere.entity.state.equip.ClientEquipState; | import electrosphere.entity.state.equip.ClientEquipState; | ||||||
| @ -243,7 +244,7 @@ public class ClientAttackTree implements BehaviorTree { | |||||||
|                             entityActor.playAnimation(currentMove.getWindupAnimationName(),1); |                             entityActor.playAnimation(currentMove.getWindupAnimationName(),1); | ||||||
|                             entityActor.incrementAnimationTime(0.0001); |                             entityActor.incrementAnimationTime(0.0001); | ||||||
|                         } |                         } | ||||||
|                         FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, currentMove.getAnimationFirstPersonWindup().getName()); |                         FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, currentMove.getAnimationFirstPersonWindup().getName(), AnimationPriorities.ATTACK); | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|             } break; |             } break; | ||||||
| @ -253,7 +254,7 @@ public class ClientAttackTree implements BehaviorTree { | |||||||
|                         entityActor.playAnimation(currentMove.getHoldAnimationName(),1); |                         entityActor.playAnimation(currentMove.getHoldAnimationName(),1); | ||||||
|                         entityActor.incrementAnimationTime(0.0001); |                         entityActor.incrementAnimationTime(0.0001); | ||||||
|                     } |                     } | ||||||
|                     FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, currentMove.getAnimationFirstPersonHold().getName()); |                     FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, currentMove.getAnimationFirstPersonHold().getName(), AnimationPriorities.ATTACK); | ||||||
|                 } |                 } | ||||||
|             } break; |             } break; | ||||||
|             case ATTACK: { |             case ATTACK: { | ||||||
| @ -262,7 +263,7 @@ public class ClientAttackTree implements BehaviorTree { | |||||||
|                         entityActor.playAnimation(currentMove.getAttackAnimationName(),1); |                         entityActor.playAnimation(currentMove.getAttackAnimationName(),1); | ||||||
|                         entityActor.incrementAnimationTime(0.0001); |                         entityActor.incrementAnimationTime(0.0001); | ||||||
|                     } |                     } | ||||||
|                     FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, currentMove.getAnimationFirstPersonAttack().getName()); |                     FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, currentMove.getAnimationFirstPersonAttack().getName(), AnimationPriorities.ATTACK); | ||||||
|                 } |                 } | ||||||
|                 //activate hitboxes |                 //activate hitboxes | ||||||
|                 List<Entity> attachedEntities = AttachUtils.getChildrenList(parent); |                 List<Entity> attachedEntities = AttachUtils.getChildrenList(parent); | ||||||
|  | |||||||
| @ -17,7 +17,6 @@ import electrosphere.entity.EntityUtils; | |||||||
| import electrosphere.entity.btree.BehaviorTree; | import electrosphere.entity.btree.BehaviorTree; | ||||||
| import electrosphere.entity.state.attack.ClientAttackTree.AttackTreeDriftState; | import electrosphere.entity.state.attack.ClientAttackTree.AttackTreeDriftState; | ||||||
| import electrosphere.entity.state.attack.ClientAttackTree.AttackTreeState; | import electrosphere.entity.state.attack.ClientAttackTree.AttackTreeState; | ||||||
| import electrosphere.entity.state.client.firstPerson.FirstPersonTree; |  | ||||||
| import electrosphere.entity.state.collidable.Impulse; | import electrosphere.entity.state.collidable.Impulse; | ||||||
| import electrosphere.entity.state.equip.ServerEquipState; | import electrosphere.entity.state.equip.ServerEquipState; | ||||||
| import electrosphere.entity.state.hitbox.HitboxCollectionState; | import electrosphere.entity.state.hitbox.HitboxCollectionState; | ||||||
| @ -264,7 +263,6 @@ public class ServerAttackTree implements BehaviorTree { | |||||||
|                         entityPoseActor.playAnimation(currentMove.getAttackAnimationName(),1); |                         entityPoseActor.playAnimation(currentMove.getAttackAnimationName(),1); | ||||||
|                         entityPoseActor.incrementAnimationTime(0.0001); |                         entityPoseActor.incrementAnimationTime(0.0001); | ||||||
|                     } |                     } | ||||||
|                     FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, currentMove.getAnimationFirstPersonAttack().getName()); |  | ||||||
|                 } |                 } | ||||||
|                 //activate hitboxes |                 //activate hitboxes | ||||||
|                 List<Entity> attachedEntities = AttachUtils.getChildrenList(parent); |                 List<Entity> attachedEntities = AttachUtils.getChildrenList(parent); | ||||||
|  | |||||||
| @ -7,6 +7,7 @@ import electrosphere.entity.EntityDataStrings; | |||||||
| import electrosphere.entity.btree.BehaviorTree; | import electrosphere.entity.btree.BehaviorTree; | ||||||
| import electrosphere.entity.btree.StateTransitionUtil; | import electrosphere.entity.btree.StateTransitionUtil; | ||||||
| import electrosphere.entity.btree.StateTransitionUtil.StateTransitionUtilItem; | import electrosphere.entity.btree.StateTransitionUtil.StateTransitionUtilItem; | ||||||
|  | import electrosphere.entity.state.AnimationPriorities; | ||||||
| import electrosphere.game.data.creature.type.block.BlockSystem; | import electrosphere.game.data.creature.type.block.BlockSystem; | ||||||
| import electrosphere.net.synchronization.BehaviorTreeIdEnums; | import electrosphere.net.synchronization.BehaviorTreeIdEnums; | ||||||
| 
 | 
 | ||||||
| @ -53,18 +54,21 @@ public class ClientBlockTree implements BehaviorTree { | |||||||
|         this.parent = parent; |         this.parent = parent; | ||||||
|         this.blockSystem = blockSystem; |         this.blockSystem = blockSystem; | ||||||
|         this.stateTransitionUtil = StateTransitionUtil.create(parent, false, new StateTransitionUtilItem[]{ |         this.stateTransitionUtil = StateTransitionUtil.create(parent, false, new StateTransitionUtilItem[]{ | ||||||
|             new StateTransitionUtilItem( |             StateTransitionUtilItem.create( | ||||||
|                 BlockState.WIND_UP, |                 BlockState.WIND_UP, | ||||||
|  |                 AnimationPriorities.BLOCK, | ||||||
|                 () -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getWindUpFirstPersonAnimation();}, |                 () -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getWindUpFirstPersonAnimation();}, | ||||||
|                 () -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getWindUpAnimation();} |                 () -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getWindUpAnimation();} | ||||||
|             ), |             ), | ||||||
|             new StateTransitionUtilItem( |             StateTransitionUtilItem.create( | ||||||
|                 BlockState.BLOCKING, |                 BlockState.BLOCKING, | ||||||
|  |                 AnimationPriorities.BLOCK, | ||||||
|                 () -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getMainFirstPersonAnimation();}, |                 () -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getMainFirstPersonAnimation();}, | ||||||
|                 () -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getMainAnimation();} |                 () -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getMainAnimation();} | ||||||
|             ), |             ), | ||||||
|             new StateTransitionUtilItem( |             StateTransitionUtilItem.create( | ||||||
|                 BlockState.COOLDOWN, |                 BlockState.COOLDOWN, | ||||||
|  |                 AnimationPriorities.BLOCK, | ||||||
|                 () -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getCooldownFirstPersonAnimation();}, |                 () -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getCooldownFirstPersonAnimation();}, | ||||||
|                 () -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getCooldownAnimation();} |                 () -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getCooldownAnimation();} | ||||||
|             ), |             ), | ||||||
|  | |||||||
| @ -14,7 +14,7 @@ import electrosphere.server.datacell.utils.ServerBehaviorTreeUtils; | |||||||
| import electrosphere.net.parser.net.message.SynchronizationMessage; | import electrosphere.net.parser.net.message.SynchronizationMessage; | ||||||
| 
 | 
 | ||||||
| import electrosphere.server.datacell.utils.DataCellSearchUtils; | import electrosphere.server.datacell.utils.DataCellSearchUtils; | ||||||
| 
 | import electrosphere.entity.state.AnimationPriorities; | ||||||
| import electrosphere.entity.state.block.ClientBlockTree.BlockState; | import electrosphere.entity.state.block.ClientBlockTree.BlockState; | ||||||
| import electrosphere.game.data.creature.type.block.BlockSystem; | import electrosphere.game.data.creature.type.block.BlockSystem; | ||||||
| import electrosphere.net.synchronization.annotation.SyncedField; | import electrosphere.net.synchronization.annotation.SyncedField; | ||||||
| @ -48,17 +48,20 @@ public class ServerBlockTree implements BehaviorTree { | |||||||
|         this.parent = parent; |         this.parent = parent; | ||||||
|         this.blockSystem = blockSystem; |         this.blockSystem = blockSystem; | ||||||
|         this.stateTransitionUtil = StateTransitionUtil.create(parent, true, new StateTransitionUtilItem[]{ |         this.stateTransitionUtil = StateTransitionUtil.create(parent, true, new StateTransitionUtilItem[]{ | ||||||
|             new StateTransitionUtilItem( |             StateTransitionUtilItem.create( | ||||||
|                 BlockState.WIND_UP, |                 BlockState.WIND_UP, | ||||||
|  |                 AnimationPriorities.BLOCK, | ||||||
|                 () -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getWindUpAnimation();}, |                 () -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getWindUpAnimation();}, | ||||||
|                 () -> {this.setState(BlockState.BLOCKING);} |                 () -> {this.setState(BlockState.BLOCKING);} | ||||||
|             ), |             ), | ||||||
|             new StateTransitionUtilItem( |             StateTransitionUtilItem.create( | ||||||
|                 BlockState.BLOCKING, |                 BlockState.BLOCKING, | ||||||
|  |                 AnimationPriorities.BLOCK, | ||||||
|                 () -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getMainAnimation();} |                 () -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getMainAnimation();} | ||||||
|             ), |             ), | ||||||
|             new StateTransitionUtilItem( |             StateTransitionUtilItem.create( | ||||||
|                 BlockState.COOLDOWN, |                 BlockState.COOLDOWN, | ||||||
|  |                 AnimationPriorities.BLOCK, | ||||||
|                 () -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getCooldownAnimation();}, |                 () -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getCooldownAnimation();}, | ||||||
|                 () -> {this.setState(BlockState.NOT_BLOCKING);} |                 () -> {this.setState(BlockState.NOT_BLOCKING);} | ||||||
|             ), |             ), | ||||||
|  | |||||||
| @ -22,22 +22,8 @@ public class FirstPersonTree implements BehaviorTree { | |||||||
|     //the amount to pull behind the camera |     //the amount to pull behind the camera | ||||||
|     double cameraViewDirOffsetZ; |     double cameraViewDirOffsetZ; | ||||||
| 
 | 
 | ||||||
|     //the animation to play currently |  | ||||||
|     String currentAnimation = "Idle"; |  | ||||||
| 
 |  | ||||||
|     @Override |     @Override | ||||||
|     public void simulate(float deltaTime) { |     public void simulate(float deltaTime) { | ||||||
|         if(Globals.firstPersonEntity != null){ |  | ||||||
|             Actor actor = EntityUtils.getActor(Globals.firstPersonEntity); |  | ||||||
|             if( |  | ||||||
|                 (!actor.isPlayingAnimation() || !actor.isPlayingAnimation(currentAnimation)) && |  | ||||||
|                 (Globals.assetManager.fetchModel(actor.getModelPath()) != null && Globals.assetManager.fetchModel(actor.getModelPath()).getAnimation(currentAnimation) != null) |  | ||||||
| 
 |  | ||||||
|             ){ |  | ||||||
|                 actor.playAnimation(currentAnimation,3); |  | ||||||
|                 actor.incrementAnimationTime(0.0001); |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
| @ -105,16 +91,17 @@ public class FirstPersonTree implements BehaviorTree { | |||||||
|      * Plays an animation if it exists |      * Plays an animation if it exists | ||||||
|      * @param animationName the name of the animation |      * @param animationName the name of the animation | ||||||
|      */ |      */ | ||||||
|     public void playAnimation(String animationName){ |     public void playAnimation(String animationName, int priority){ | ||||||
|         this.currentAnimation = animationName; |         if(Globals.firstPersonEntity != null){ | ||||||
|     } |             Actor actor = EntityUtils.getActor(Globals.firstPersonEntity); | ||||||
| 
 |             if( | ||||||
|     /** |                 (!actor.isPlayingAnimation() || !actor.isPlayingAnimation(animationName)) && | ||||||
|      * Gets the animation currently playing |                 (Globals.assetManager.fetchModel(actor.getModelPath()) != null && Globals.assetManager.fetchModel(actor.getModelPath()).getAnimation(animationName) != null) | ||||||
|      * @return The name of the animation |             ){ | ||||||
|      */ |                 actor.playAnimation(animationName,priority); | ||||||
|     public String getCurrentAnimation(){ |                 actor.incrementAnimationTime(0.0001); | ||||||
|         return currentAnimation; |             } | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
| @ -122,9 +109,9 @@ public class FirstPersonTree implements BehaviorTree { | |||||||
|      * @param entity The entity |      * @param entity The entity | ||||||
|      * @param animationName the name of the animation |      * @param animationName the name of the animation | ||||||
|      */ |      */ | ||||||
|     public static void conditionallyPlayAnimation(Entity entity, String animationName){ |     public static void conditionallyPlayAnimation(Entity entity, String animationName, int priority){ | ||||||
|         if(entity != null && hasTree(entity)){ |         if(entity != null && FirstPersonTree.hasTree(entity)){ | ||||||
|             getTree(entity).playAnimation(animationName); |             FirstPersonTree.getTree(entity).playAnimation(animationName, priority); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  | |||||||
| @ -2,6 +2,7 @@ package electrosphere.entity.state.idle; | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| import electrosphere.net.synchronization.BehaviorTreeIdEnums; | import electrosphere.net.synchronization.BehaviorTreeIdEnums; | ||||||
|  | import electrosphere.entity.state.AnimationPriorities; | ||||||
| import electrosphere.entity.state.attack.ClientAttackTree; | import electrosphere.entity.state.attack.ClientAttackTree; | ||||||
| import electrosphere.entity.state.client.firstPerson.FirstPersonTree; | import electrosphere.entity.state.client.firstPerson.FirstPersonTree; | ||||||
| import electrosphere.entity.state.movement.AirplaneMovementTree; | import electrosphere.entity.state.movement.AirplaneMovementTree; | ||||||
| @ -99,8 +100,8 @@ public class ClientIdleTree implements BehaviorTree { | |||||||
|                     ){ |                     ){ | ||||||
|                         entityActor.playAnimation(idleData.getIdleAnimation(),3); |                         entityActor.playAnimation(idleData.getIdleAnimation(),3); | ||||||
|                         entityActor.incrementAnimationTime(0.0001); |                         entityActor.incrementAnimationTime(0.0001); | ||||||
|                         FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, idleData.getFirstPersonIdleAnimation()); |  | ||||||
|                     } |                     } | ||||||
|  |                     FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, idleData.getFirstPersonIdleAnimation(), AnimationPriorities.IDLE); | ||||||
|                 } |                 } | ||||||
|                 break; |                 break; | ||||||
|             case NOT_IDLE: |             case NOT_IDLE: | ||||||
|  | |||||||
| @ -5,6 +5,7 @@ import electrosphere.entity.Entity; | |||||||
| import electrosphere.entity.EntityDataStrings; | import electrosphere.entity.EntityDataStrings; | ||||||
| import electrosphere.entity.EntityUtils; | import electrosphere.entity.EntityUtils; | ||||||
| import electrosphere.entity.btree.BehaviorTree; | import electrosphere.entity.btree.BehaviorTree; | ||||||
|  | import electrosphere.entity.state.AnimationPriorities; | ||||||
| import electrosphere.entity.state.client.firstPerson.FirstPersonTree; | import electrosphere.entity.state.client.firstPerson.FirstPersonTree; | ||||||
| import electrosphere.game.data.creature.type.movement.FallMovementSystem; | import electrosphere.game.data.creature.type.movement.FallMovementSystem; | ||||||
| import electrosphere.renderer.actor.Actor; | import electrosphere.renderer.actor.Actor; | ||||||
| @ -51,8 +52,8 @@ public class FallTree implements BehaviorTree { | |||||||
|                 ){ |                 ){ | ||||||
|                     entityActor.playAnimation(fallMovementSystem.getAnimationFall().getName(),1); |                     entityActor.playAnimation(fallMovementSystem.getAnimationFall().getName(),1); | ||||||
|                     entityActor.incrementAnimationTime(0.0001); |                     entityActor.incrementAnimationTime(0.0001); | ||||||
|                     FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, fallMovementSystem.getAnimationFirstPersonFall().getName()); |  | ||||||
|                 } |                 } | ||||||
|  |                 FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, fallMovementSystem.getAnimationFirstPersonFall().getName(), AnimationPriorities.FALL); | ||||||
|             } |             } | ||||||
|             break; |             break; | ||||||
|             case INACTIVE: |             case INACTIVE: | ||||||
| @ -88,8 +89,8 @@ public class FallTree implements BehaviorTree { | |||||||
|                 ){ |                 ){ | ||||||
|                     entityActor.playAnimation(fallMovementSystem.getAnimationLand().getName(),1); |                     entityActor.playAnimation(fallMovementSystem.getAnimationLand().getName(),1); | ||||||
|                     entityActor.incrementAnimationTime(0.0001); |                     entityActor.incrementAnimationTime(0.0001); | ||||||
|                     FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, fallMovementSystem.getAnimationFirstPersonLand().getName()); |  | ||||||
|                 } |                 } | ||||||
|  |                 FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, fallMovementSystem.getAnimationFirstPersonLand().getName(), AnimationPriorities.LAND); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -9,6 +9,7 @@ import electrosphere.entity.Entity; | |||||||
| import electrosphere.entity.EntityDataStrings; | import electrosphere.entity.EntityDataStrings; | ||||||
| import electrosphere.entity.EntityUtils; | import electrosphere.entity.EntityUtils; | ||||||
| import electrosphere.entity.btree.BehaviorTree; | import electrosphere.entity.btree.BehaviorTree; | ||||||
|  | import electrosphere.entity.state.AnimationPriorities; | ||||||
| import electrosphere.entity.state.client.firstPerson.FirstPersonTree; | import electrosphere.entity.state.client.firstPerson.FirstPersonTree; | ||||||
| import electrosphere.entity.state.gravity.GravityUtils; | import electrosphere.entity.state.gravity.GravityUtils; | ||||||
| import electrosphere.game.data.creature.type.movement.JumpMovementSystem; | import electrosphere.game.data.creature.type.movement.JumpMovementSystem; | ||||||
| @ -62,8 +63,8 @@ public class JumpTree implements BehaviorTree { | |||||||
|                 if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(jumpData.getAnimationJump().getName())){ |                 if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(jumpData.getAnimationJump().getName())){ | ||||||
|                     entityActor.playAnimation(jumpData.getAnimationJump().getName(),1); |                     entityActor.playAnimation(jumpData.getAnimationJump().getName(),1); | ||||||
|                     entityActor.incrementAnimationTime(0.0001); |                     entityActor.incrementAnimationTime(0.0001); | ||||||
|                     FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, jumpData.getAnimationFirstPersonJump().getName()); |  | ||||||
|                 } |                 } | ||||||
|  |                 FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, jumpData.getAnimationFirstPersonJump().getName(), AnimationPriorities.JUMP); | ||||||
|             } |             } | ||||||
|             currentFrame++; |             currentFrame++; | ||||||
|             currentJumpForce = currentJumpForce * jumpFalloff; |             currentJumpForce = currentJumpForce * jumpFalloff; | ||||||
|  | |||||||
| @ -14,6 +14,7 @@ import electrosphere.entity.Entity; | |||||||
| import electrosphere.entity.EntityDataStrings; | import electrosphere.entity.EntityDataStrings; | ||||||
| import electrosphere.entity.EntityUtils; | import electrosphere.entity.EntityUtils; | ||||||
| import electrosphere.entity.btree.BehaviorTree; | import electrosphere.entity.btree.BehaviorTree; | ||||||
|  | import electrosphere.entity.state.AnimationPriorities; | ||||||
| import electrosphere.entity.state.attack.ClientAttackTree; | import electrosphere.entity.state.attack.ClientAttackTree; | ||||||
| import electrosphere.entity.state.attack.ClientAttackTree.AttackTreeState; | import electrosphere.entity.state.attack.ClientAttackTree.AttackTreeState; | ||||||
| import electrosphere.entity.state.client.firstPerson.FirstPersonTree; | import electrosphere.entity.state.client.firstPerson.FirstPersonTree; | ||||||
| @ -292,8 +293,8 @@ public class ClientGroundMovementTree implements BehaviorTree { | |||||||
|                     ){ |                     ){ | ||||||
|                         entityActor.playAnimation(animationToPlay,1); |                         entityActor.playAnimation(animationToPlay,1); | ||||||
|                         entityActor.incrementAnimationTime(0.0001); |                         entityActor.incrementAnimationTime(0.0001); | ||||||
|                         FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, groundMovementData.getAnimationFirstPersonStartup().getName()); |  | ||||||
|                     } |                     } | ||||||
|  |                     FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, groundMovementData.getAnimationFirstPersonStartup().getName(), AnimationPriorities.GROUND_MOVE); | ||||||
|                 } |                 } | ||||||
|                 //run startup code |                 //run startup code | ||||||
|                 velocity = velocity + acceleration * (float)Globals.timekeeper.getSimFrameTime(); |                 velocity = velocity + acceleration * (float)Globals.timekeeper.getSimFrameTime(); | ||||||
| @ -326,8 +327,8 @@ public class ClientGroundMovementTree implements BehaviorTree { | |||||||
|                     ){ |                     ){ | ||||||
|                         entityActor.playAnimation(animationToPlay,1); |                         entityActor.playAnimation(animationToPlay,1); | ||||||
|                         entityActor.incrementAnimationTime(0.0001); |                         entityActor.incrementAnimationTime(0.0001); | ||||||
|                         FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, groundMovementData.getAnimationFirstPersonLoop().getName()); |  | ||||||
|                     } |                     } | ||||||
|  |                     FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, groundMovementData.getAnimationFirstPersonLoop().getName(), AnimationPriorities.GROUND_MOVE); | ||||||
|                 } |                 } | ||||||
|                 if(velocity != maxNaturalVelocity){ |                 if(velocity != maxNaturalVelocity){ | ||||||
|                     velocity = maxNaturalVelocity; |                     velocity = maxNaturalVelocity; | ||||||
| @ -354,8 +355,8 @@ public class ClientGroundMovementTree implements BehaviorTree { | |||||||
|                         ){ |                         ){ | ||||||
|                         entityActor.playAnimation(animationToPlay,1); |                         entityActor.playAnimation(animationToPlay,1); | ||||||
|                         entityActor.incrementAnimationTime(0.0001); |                         entityActor.incrementAnimationTime(0.0001); | ||||||
|                         FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, groundMovementData.getAnimationFirstPersonWindDown().getName()); |  | ||||||
|                     } |                     } | ||||||
|  |                     FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, groundMovementData.getAnimationFirstPersonWindDown().getName(), AnimationPriorities.GROUND_MOVE); | ||||||
|                 } |                 } | ||||||
|                 //velocity stuff |                 //velocity stuff | ||||||
|                 velocity = velocity - acceleration * (float)Globals.timekeeper.getSimFrameTime(); |                 velocity = velocity - acceleration * (float)Globals.timekeeper.getSimFrameTime(); | ||||||
|  | |||||||
| @ -2,12 +2,14 @@ package electrosphere.menu.debug; | |||||||
| 
 | 
 | ||||||
| import java.util.LinkedList; | import java.util.LinkedList; | ||||||
| import java.util.List; | import java.util.List; | ||||||
|  | import java.util.PriorityQueue; | ||||||
| 
 | 
 | ||||||
| import org.joml.Quaterniond; | import org.joml.Quaterniond; | ||||||
| 
 | 
 | ||||||
| import electrosphere.engine.Globals; | import electrosphere.engine.Globals; | ||||||
| import electrosphere.entity.Entity; | import electrosphere.entity.Entity; | ||||||
| import electrosphere.entity.EntityUtils; | import electrosphere.entity.EntityUtils; | ||||||
|  | import electrosphere.entity.state.client.firstPerson.FirstPersonTree; | ||||||
| import electrosphere.entity.state.equip.ClientEquipState; | import electrosphere.entity.state.equip.ClientEquipState; | ||||||
| import electrosphere.entity.types.attach.AttachUtils; | import electrosphere.entity.types.attach.AttachUtils; | ||||||
| import electrosphere.entity.types.creature.CreatureUtils; | import electrosphere.entity.types.creature.CreatureUtils; | ||||||
| @ -16,6 +18,7 @@ import electrosphere.entity.types.item.ItemUtils; | |||||||
| import electrosphere.game.data.creature.type.equip.EquipPoint; | import electrosphere.game.data.creature.type.equip.EquipPoint; | ||||||
| import electrosphere.logger.LoggerInterface; | import electrosphere.logger.LoggerInterface; | ||||||
| import electrosphere.renderer.actor.Actor; | import electrosphere.renderer.actor.Actor; | ||||||
|  | import electrosphere.renderer.actor.ActorAnimationMask; | ||||||
| import electrosphere.renderer.actor.ActorMeshMask; | import electrosphere.renderer.actor.ActorMeshMask; | ||||||
| import electrosphere.renderer.anim.AnimChannel; | import electrosphere.renderer.anim.AnimChannel; | ||||||
| import electrosphere.renderer.anim.Animation; | import electrosphere.renderer.anim.Animation; | ||||||
| @ -31,33 +34,34 @@ import imgui.ImGui; | |||||||
|  */ |  */ | ||||||
| public class ImGuiEntityMacros { | public class ImGuiEntityMacros { | ||||||
|      |      | ||||||
|     //window for viewing main player entity's stats on both client and server |     //window for selecting entities to view | ||||||
|     protected static ImGuiWindow clientEntityWindow; |     protected static ImGuiWindow clientEntityListWindow; | ||||||
|     private static boolean filterToCreatures = false; //filters the entity list to just creatures |     private static boolean filterToCreatures = true; //filters the entity list to just creatures | ||||||
| 
 | 
 | ||||||
|     //views stats about an actor |     //window for viewing details about an entity | ||||||
|     protected static ImGuiWindow actorView; |     protected static ImGuiWindow clientEntityDetailWindow; | ||||||
|     static Entity actorViewEntity; //the entity whose actor we're viewing in the actor window |     private static Entity detailViewEntity = null; | ||||||
| 
 | 
 | ||||||
|     //views stats about equip state |     //tree node values | ||||||
|     protected static ImGuiWindow equipStateView; |     private static boolean showActorTab = false; //show the actor tab | ||||||
|     static Entity equipViewEntity; //the entity whose equip state we're viewing in the equip window |     private static boolean showEquipStateTab = false; //actor details | ||||||
|  |     private static boolean showFirstPersonTab = false; //first person tab | ||||||
|  |     private static boolean showLinkedEntitiesTab = false;//show linked entities | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Creates the windows in this file |      * Creates the windows in this file | ||||||
|      */ |      */ | ||||||
|     protected static void createClientEntityWindows(){ |     protected static void createClientEntityWindows(){ | ||||||
|         createClientEntityDebugWindow(); |         createClientEntityDetailWindow(); | ||||||
|         createActorViewDebugWindow(); |         createClientEntitySelectionWindow(); | ||||||
|         createEquipStateDebugWindow(); |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Client scene entity view |      * Client scene entity view | ||||||
|      */ |      */ | ||||||
|     protected static void createClientEntityDebugWindow(){ |     protected static void createClientEntitySelectionWindow(){ | ||||||
|         clientEntityWindow = new ImGuiWindow("Client Entities"); |         clientEntityListWindow = new ImGuiWindow("Client Entities"); | ||||||
|         clientEntityWindow.setCallback(new ImGuiWindowCallback() { |         clientEntityListWindow.setCallback(new ImGuiWindowCallback() { | ||||||
|             @Override |             @Override | ||||||
|             public void exec() { |             public void exec() { | ||||||
|                 //audio engine details |                 //audio engine details | ||||||
| @ -73,53 +77,111 @@ public class ImGuiEntityMacros { | |||||||
|                     ImGui.beginGroup(); |                     ImGui.beginGroup(); | ||||||
|                     ImGui.pushID(entity.getId()); |                     ImGui.pushID(entity.getId()); | ||||||
|                     ImGui.text("Id: " + entity.getId() + " (" + getEntityName(entity) + ")"); |                     ImGui.text("Id: " + entity.getId() + " (" + getEntityName(entity) + ")"); | ||||||
|                     if(CreatureUtils.isCreature(entity)){ |                     if(ImGui.button("Details")){ | ||||||
|                         if(EntityUtils.getActor(entity) != null){ |                         showEntity(entity); | ||||||
|                             if(ImGui.button("Actor View")){ |  | ||||||
|                                 actorViewEntity = entity; |  | ||||||
|                                 actorView.setOpen(true); |  | ||||||
|                             } |  | ||||||
|                         } |  | ||||||
|                         if(ClientEquipState.getClientEquipState(entity) != null){ |  | ||||||
|                             if(ImGui.button("Client Equip State View")){ |  | ||||||
|                                 equipViewEntity = entity; |  | ||||||
|                                 equipStateView.setOpen(true); |  | ||||||
|                             } |  | ||||||
|                         } |  | ||||||
|                     } |                     } | ||||||
|                     ImGui.popID(); |                     ImGui.popID(); | ||||||
|                     ImGui.endGroup(); |                     ImGui.endGroup(); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         }); |         }); | ||||||
|         clientEntityWindow.setOpen(false); |         clientEntityListWindow.setOpen(false); | ||||||
|         Globals.renderingEngine.getImGuiPipeline().addImGuiWindow(clientEntityWindow); |         Globals.renderingEngine.getImGuiPipeline().addImGuiWindow(clientEntityListWindow); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * View details about a client entity | ||||||
|  |      */ | ||||||
|  |     protected static void createClientEntityDetailWindow(){ | ||||||
|  |         clientEntityDetailWindow = new ImGuiWindow("Entity Data"); | ||||||
|  | 
 | ||||||
|  |         clientEntityDetailWindow.setCallback(new ImGuiWindowCallback() { | ||||||
|  |             @Override | ||||||
|  |             public void exec() { | ||||||
|  |                 ImGui.sameLine(); | ||||||
|  |                 if(ImGui.treeNode("Views")){ | ||||||
|  |                     if(EntityUtils.getActor(detailViewEntity) != null && ImGui.checkbox("Actor Details", showActorTab)){ | ||||||
|  |                         showActorTab = !showActorTab; | ||||||
|  |                     } | ||||||
|  |                     if(ClientEquipState.hasEquipState(detailViewEntity) && ImGui.checkbox("Equip State", showEquipStateTab)){ | ||||||
|  |                         showEquipStateTab = !showEquipStateTab; | ||||||
|  |                     } | ||||||
|  |                     if(FirstPersonTree.hasTree(detailViewEntity) && ImGui.checkbox("First Person", showFirstPersonTab)){ | ||||||
|  |                         showFirstPersonTab = !showFirstPersonTab; | ||||||
|  |                     } | ||||||
|  |                     if( | ||||||
|  |                         (AttachUtils.hasChildren(detailViewEntity) || AttachUtils.getParent(detailViewEntity) != null || detailViewEntity == Globals.firstPersonEntity || detailViewEntity == Globals.playerEntity) && | ||||||
|  |                         ImGui.checkbox("Linked entities`", showLinkedEntitiesTab) | ||||||
|  |                     ){ | ||||||
|  |                         showLinkedEntitiesTab = !showLinkedEntitiesTab; | ||||||
|  |                     } | ||||||
|  |                     ImGui.treePop(); | ||||||
|  |                 } | ||||||
|  |                 ImGui.nextColumn(); | ||||||
|  |                 drawActorView(); | ||||||
|  |                 drawEquipState(); | ||||||
|  |                 drawFirstPersonView(); | ||||||
|  |                 drawLinkedEntities(); | ||||||
|  |             } | ||||||
|  |         }); | ||||||
|  |         clientEntityDetailWindow.setOpen(false); | ||||||
|  |         Globals.renderingEngine.getImGuiPipeline().addImGuiWindow(clientEntityDetailWindow); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Shows the entity window for a specific entity | ||||||
|  |      * @param entity The entity | ||||||
|  |      */ | ||||||
|  |     protected static void showEntity(Entity entity){ | ||||||
|  |         detailViewEntity = entity; | ||||||
|  |         clientEntityDetailWindow.setOpen(true); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Client scene entity view |      * Client scene entity view | ||||||
|      */ |      */ | ||||||
|     protected static void createActorViewDebugWindow(){ |     protected static void drawActorView(){ | ||||||
|         actorView = new ImGuiWindow("Actor View"); |         if(showActorTab && ImGui.collapsingHeader("Actor Details")){ | ||||||
|         actorView.setCallback(new ImGuiWindowCallback() { |             if(detailViewEntity != null && EntityUtils.getActor(detailViewEntity) != null){ | ||||||
|             @Override |                 Actor actor = EntityUtils.getActor(detailViewEntity); | ||||||
|             public void exec() { |  | ||||||
|                 if(actorViewEntity != null && EntityUtils.getActor(actorViewEntity) != null){ |  | ||||||
|                     Actor actor = EntityUtils.getActor(actorViewEntity); |  | ||||||
|      |      | ||||||
|                     //mesh mask |                 //mesh mask | ||||||
|                     if(ImGui.collapsingHeader("Mesh Mask")){ |                 if(ImGui.collapsingHeader("Mesh Mask")){ | ||||||
|                         ActorMeshMask meshMask = actor.getMeshMask(); |                     ActorMeshMask meshMask = actor.getMeshMask(); | ||||||
|                         ImGui.text("To Draw Meshes:"); |                     ImGui.text("To Draw Meshes:"); | ||||||
|                         for(Mesh mesh : meshMask.getToDrawMeshes()){ |                     for(Mesh mesh : meshMask.getToDrawMeshes()){ | ||||||
|                             ImGui.text(mesh.getMeshName()); |                         ImGui.text(mesh.getMeshName()); | ||||||
|                         } |                     } | ||||||
|                         ImGui.text("Blocked Meshes:"); |                     ImGui.text("Blocked Meshes:"); | ||||||
|                         for(String blocked : meshMask.getBlockedMeshes()){ |                     for(String blocked : meshMask.getBlockedMeshes()){ | ||||||
|                             ImGui.text(blocked); |                         ImGui.text(blocked); | ||||||
|  |                     } | ||||||
|  |                 } | ||||||
|  | 
 | ||||||
|  |                 //animation queue | ||||||
|  |                 if(ImGui.collapsingHeader("Animation Queue")){ | ||||||
|  |                     PriorityQueue<ActorAnimationMask> animationQueue = actor.getAnimationQueue(); | ||||||
|  |                     for(ActorAnimationMask mask : animationQueue){ | ||||||
|  |                         ImGui.text(mask.getPriority() + " " + mask.getAnimationName()); | ||||||
|  |                     } | ||||||
|  |                 } | ||||||
|  |      | ||||||
|  |                 //Browsable list of all animations with their data | ||||||
|  |                 if(ImGui.collapsingHeader("Animation Channel Data")){ | ||||||
|  |                     Model model = Globals.assetManager.fetchModel(actor.getModelPath()); | ||||||
|  |                     for(Animation animation : model.getAnimations()){ | ||||||
|  |                         ImGui.text(" - " + animation.name); | ||||||
|  |                         for(AnimChannel channel : animation.channels){ | ||||||
|  |                             ImGui.text("=" + channel.getNodeID() + "="); | ||||||
|  |                             ImGui.text("" + channel.getCurrentPosition()); | ||||||
|  |                             ImGui.text("" + channel.getCurrentRotation()); | ||||||
|  |                             ImGui.text("" + channel.getCurrentScale()); | ||||||
|                         } |                         } | ||||||
|                     } |                     } | ||||||
|  |                 } | ||||||
| 
 | 
 | ||||||
|  |                 //print data macros | ||||||
|  |                 if(ImGui.collapsingHeader("Print Data")){ | ||||||
|                     //print bone values |                     //print bone values | ||||||
|                     if(ImGui.button("Print current bone values")){ |                     if(ImGui.button("Print current bone values")){ | ||||||
|                         for(Bone bone : actor.getBoneValues()){ |                         for(Bone bone : actor.getBoneValues()){ | ||||||
| @ -133,91 +195,109 @@ public class ImGuiEntityMacros { | |||||||
|                         Model model = Globals.assetManager.fetchModel(actor.getModelPath()); |                         Model model = Globals.assetManager.fetchModel(actor.getModelPath()); | ||||||
|                         model.describeAllAnimations(); |                         model.describeAllAnimations(); | ||||||
|                     } |                     } | ||||||
| 
 |  | ||||||
|                     //Browsable list of all animations with their data |  | ||||||
|                     if(ImGui.collapsingHeader("Animation Channel Data")){ |  | ||||||
|                         Model model = Globals.assetManager.fetchModel(actor.getModelPath()); |  | ||||||
|                         for(Animation animation : model.getAnimations()){ |  | ||||||
|                             ImGui.text(" - " + animation.name); |  | ||||||
|                             for(AnimChannel channel : animation.channels){ |  | ||||||
|                                 ImGui.text("=" + channel.getNodeID() + "="); |  | ||||||
|                                 ImGui.text("" + channel.getCurrentPosition()); |  | ||||||
|                                 ImGui.text("" + channel.getCurrentRotation()); |  | ||||||
|                                 ImGui.text("" + channel.getCurrentScale()); |  | ||||||
|                             } |  | ||||||
|                         } |  | ||||||
|                     } |  | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         }); |         } | ||||||
|         actorView.setOpen(false); |  | ||||||
|         Globals.renderingEngine.getImGuiPipeline().addImGuiWindow(actorView); |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * First person data | ||||||
|  |      */ | ||||||
|  |     protected static void drawFirstPersonView(){ | ||||||
|  |         if(showFirstPersonTab && ImGui.collapsingHeader("First Person Tree")){ | ||||||
|  |             FirstPersonTree firstPersonTree = FirstPersonTree.getTree(detailViewEntity); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     //stores the edited rotation values | ||||||
|  |     private static float[] rotationValuesFirstPerson = new float[]{ | ||||||
|  |         0,0,0 | ||||||
|  |     }; | ||||||
|  |     private static float[] rotationValuesThirdPerson = new float[]{ | ||||||
|  |         0,0,0 | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Client scene equip state view |      * Client scene equip state view | ||||||
|      */ |      */ | ||||||
|     protected static void createEquipStateDebugWindow(){ |     protected static void drawEquipState(){ | ||||||
|         equipStateView = new ImGuiWindow("Client Equip State View"); |         if(showEquipStateTab && ImGui.collapsingHeader("Equip State Details")){ | ||||||
|         equipStateView.setCallback(new ImGuiWindowCallback() { |             if(detailViewEntity != null && ClientEquipState.getClientEquipState(detailViewEntity) != null){ | ||||||
| 
 |                 ClientEquipState clientEquipState = ClientEquipState.getClientEquipState(detailViewEntity); | ||||||
|             //stores the edited rotation values |                 if(ImGui.collapsingHeader("All Equip Points")){ | ||||||
|             float[] rotationValuesFirstPerson = new float[]{ |                     for(EquipPoint point : clientEquipState.getAllEquipPoints()){ | ||||||
|                 0,0,0 |                         if(ImGui.collapsingHeader(point.getEquipPointId())){ | ||||||
|             }; |                             ImGui.text("Has item equipped: " + (clientEquipState.getEquippedItemAtPoint(point.getEquipPointId()) != null)); | ||||||
|             float[] rotationValuesThirdPerson = new float[]{ |                             ImGui.text("Bone (Third Person): " + point.getBone()); | ||||||
|                 0,0,0 |                             ImGui.text("Bone (First Person): " + point.getFirstPersonBone()); | ||||||
|             }; |                             ImGui.text("[Third Person] Rotation: " + AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationThirdPerson())); | ||||||
| 
 |                             if(ImGui.sliderFloat3("[Third Person] Rotation (In Euler along x,y,z)", rotationValuesThirdPerson, 0, (float)(Math.PI * 2))){ | ||||||
|             @Override |                                 Quaterniond rotation = new Quaterniond().rotateXYZ(rotationValuesThirdPerson[0], rotationValuesThirdPerson[1], rotationValuesThirdPerson[2]); | ||||||
|             public void exec() { |                                 List<Float> newValues = new LinkedList<Float>(); | ||||||
|                 if(equipViewEntity != null && ClientEquipState.getClientEquipState(equipViewEntity) != null){ |                                 newValues.add((float)rotation.x); | ||||||
|                     ClientEquipState clientEquipState = ClientEquipState.getClientEquipState(equipViewEntity); |                                 newValues.add((float)rotation.y); | ||||||
| 
 |                                 newValues.add((float)rotation.z); | ||||||
|                     if(ImGui.collapsingHeader("All Equip Points")){ |                                 newValues.add((float)rotation.w); | ||||||
|                         for(EquipPoint point : clientEquipState.getAllEquipPoints()){ |                                 point.setOffsetRotationThirdPerson(newValues); | ||||||
|                             if(ImGui.collapsingHeader(point.getEquipPointId())){ |                                 Entity equippedEntity = clientEquipState.getEquippedItemAtPoint(point.getEquipPointId()); | ||||||
|                                 ImGui.text("Has item equipped: " + (clientEquipState.getEquippedItemAtPoint(point.getEquipPointId()) != null)); |                                 if(equippedEntity != null){ | ||||||
|                                 ImGui.text("Bone (Third Person): " + point.getBone()); |                                     AttachUtils.setRotationOffset(equippedEntity, AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationThirdPerson())); | ||||||
|                                 ImGui.text("Bone (First Person): " + point.getFirstPersonBone()); |  | ||||||
|                                 ImGui.text("[Third Person] Rotation: " + AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationThirdPerson())); |  | ||||||
|                                 if(ImGui.sliderFloat3("[Third Person] Rotation (In Euler along x,y,z)", rotationValuesThirdPerson, 0, (float)(Math.PI * 2))){ |  | ||||||
|                                     Quaterniond rotation = new Quaterniond().rotateXYZ(rotationValuesThirdPerson[0], rotationValuesThirdPerson[1], rotationValuesThirdPerson[2]); |  | ||||||
|                                     List<Float> newValues = new LinkedList<Float>(); |  | ||||||
|                                     newValues.add((float)rotation.x); |  | ||||||
|                                     newValues.add((float)rotation.y); |  | ||||||
|                                     newValues.add((float)rotation.z); |  | ||||||
|                                     newValues.add((float)rotation.w); |  | ||||||
|                                     point.setOffsetRotationThirdPerson(newValues); |  | ||||||
|                                     Entity equippedEntity = clientEquipState.getEquippedItemAtPoint(point.getEquipPointId()); |  | ||||||
|                                     if(equippedEntity != null){ |  | ||||||
|                                         AttachUtils.setRotationOffset(equippedEntity, AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationThirdPerson())); |  | ||||||
|                                     } |  | ||||||
|                                 } |                                 } | ||||||
|                                 ImGui.text("[First Person] Rotation: " + AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationFirstPerson())); |                             } | ||||||
|                                 if(ImGui.sliderFloat3("[First Person] Rotation (In Euler along x,y,z)", rotationValuesFirstPerson, 0, (float)(Math.PI * 2))){ |                             ImGui.text("[First Person] Rotation: " + AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationFirstPerson())); | ||||||
|                                     Quaterniond rotation = new Quaterniond().rotateXYZ(rotationValuesFirstPerson[0], rotationValuesFirstPerson[1], rotationValuesFirstPerson[2]); |                             if(ImGui.sliderFloat3("[First Person] Rotation (In Euler along x,y,z)", rotationValuesFirstPerson, 0, (float)(Math.PI * 2))){ | ||||||
|                                     List<Float> newValues = new LinkedList<Float>(); |                                 Quaterniond rotation = new Quaterniond().rotateXYZ(rotationValuesFirstPerson[0], rotationValuesFirstPerson[1], rotationValuesFirstPerson[2]); | ||||||
|                                     newValues.add((float)rotation.x); |                                 List<Float> newValues = new LinkedList<Float>(); | ||||||
|                                     newValues.add((float)rotation.y); |                                 newValues.add((float)rotation.x); | ||||||
|                                     newValues.add((float)rotation.z); |                                 newValues.add((float)rotation.y); | ||||||
|                                     newValues.add((float)rotation.w); |                                 newValues.add((float)rotation.z); | ||||||
|                                     point.setOffsetRotationFirstPerson(newValues); |                                 newValues.add((float)rotation.w); | ||||||
|                                     Entity equippedEntity = clientEquipState.getEquippedItemAtPoint(point.getEquipPointId()); |                                 point.setOffsetRotationFirstPerson(newValues); | ||||||
|                                     if(equippedEntity != null){ |                                 Entity equippedEntity = clientEquipState.getEquippedItemAtPoint(point.getEquipPointId()); | ||||||
|                                         AttachUtils.setRotationOffset(equippedEntity, AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationFirstPerson())); |                                 if(equippedEntity != null){ | ||||||
|                                     } |                                     AttachUtils.setRotationOffset(equippedEntity, AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationFirstPerson())); | ||||||
|                                 } |                                 } | ||||||
|                             } |                             } | ||||||
|                         } |                         } | ||||||
|                     } |                     } | ||||||
|  |                 } | ||||||
|                  |                  | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Client scene equip state view | ||||||
|  |      */ | ||||||
|  |     protected static void drawLinkedEntities(){ | ||||||
|  |         if(showLinkedEntitiesTab && ImGui.collapsingHeader("Linked entities")){ | ||||||
|  |             if(detailViewEntity == Globals.playerEntity && ImGui.button("View Model")){ | ||||||
|  |                 showEntity(Globals.firstPersonEntity); | ||||||
|  |             } | ||||||
|  |             if(detailViewEntity == Globals.firstPersonEntity && ImGui.button("3rd Person Model")){ | ||||||
|  |                 showEntity(Globals.playerEntity); | ||||||
|  |             } | ||||||
|  |             if(AttachUtils.getParent(detailViewEntity) != null && ImGui.button("Parent")){ | ||||||
|  |                 showEntity(AttachUtils.getParent(detailViewEntity)); | ||||||
|  |             } | ||||||
|  |             if(AttachUtils.hasChildren(detailViewEntity) && ImGui.collapsingHeader("Children")){ | ||||||
|  |                 for(Entity child : AttachUtils.getChildrenList(detailViewEntity)){ | ||||||
|  |                     if(ImGui.button("Child " + child.getId())){ | ||||||
|  |                         showEntity(child); | ||||||
|  |                     } | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         }); |             if(ClientEquipState.hasEquipState(detailViewEntity) && ImGui.collapsingHeader("Equipped")){ | ||||||
|         equipStateView.setOpen(false); |                 ClientEquipState clientEquipState = ClientEquipState.getClientEquipState(detailViewEntity); | ||||||
|         Globals.renderingEngine.getImGuiPipeline().addImGuiWindow(equipStateView); |                 for(String equippedPoint : clientEquipState.getEquippedPoints()){ | ||||||
|  |                     Entity entity = clientEquipState.getEquippedItemAtPoint(equippedPoint); | ||||||
|  |                     if(ImGui.button("Slot: " + equippedPoint)){ | ||||||
|  |                         showEntity(entity); | ||||||
|  |                     } | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|  | |||||||
| @ -277,7 +277,7 @@ public class ImGuiWindowMacros { | |||||||
|                 } |                 } | ||||||
|                 //client entity debug |                 //client entity debug | ||||||
|                 if(ImGui.button("Client Entity Debug")){ |                 if(ImGui.button("Client Entity Debug")){ | ||||||
|                     ImGuiEntityMacros.clientEntityWindow.setOpen(true); |                     ImGuiEntityMacros.clientEntityListWindow.setOpen(true); | ||||||
|                 } |                 } | ||||||
|                 //controls state debug |                 //controls state debug | ||||||
|                 if(ImGui.button("Control State Debug")){ |                 if(ImGui.button("Control State Debug")){ | ||||||
|  | |||||||
| @ -169,6 +169,14 @@ public class Actor { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * Gets the animation queue | ||||||
|  |      * @return The animation queue | ||||||
|  |      */ | ||||||
|  |     public PriorityQueue<ActorAnimationMask> getAnimationQueue(){ | ||||||
|  |         return animationQueue; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     void applyAnimationMasks(Model model){ |     void applyAnimationMasks(Model model){ | ||||||
|         // Model model = Globals.assetManager.fetchModel(modelPath); |         // Model model = Globals.assetManager.fetchModel(modelPath); | ||||||
|         // if(model != null){ |         // if(model != null){ | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user