devtools
	
		
			
	
		
	
	
		
	
		
			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
							
								
									58c5ac0512
								
							
						
					
					
						commit
						56ed405aea
					
				| @ -256,7 +256,8 @@ | ||||
|                     "bone" : "Hand.R", | ||||
|                     "firstPersonBone" : "hand.R", | ||||
|                     "offsetVector" : [0,0,0], | ||||
|                     "offsetRotation" : [-0.334,0.145,-0.28,0.89], | ||||
|                     "offsetRotationThirdPerson" : [-0.334,0.145,-0.28,0.89], | ||||
|                     "offsetRotationFirstPerson" : [0.923,-0.143,-0.232,0.24], | ||||
|                     "canBlock" : true, | ||||
|                     "equipClassWhitelist" : [ | ||||
|                         "tool", | ||||
|  | ||||
| @ -450,6 +450,7 @@ Attacker ai tree | ||||
| (07/24/2024) | ||||
| 2 Hand katana | ||||
| Switching between first and third person | ||||
| Devtools for updating first person attachment rotations | ||||
| 
 | ||||
| 
 | ||||
| # TODO | ||||
|  | ||||
| @ -131,7 +131,7 @@ public class ClientEquipState implements BehaviorTree { | ||||
|                             meshMask.queueMesh(modelName, toDraw); | ||||
|                         } | ||||
|                         //attach to parent bone | ||||
|                         AttachUtils.clientAttachEntityToEntityAtBone(parent, toEquip, point.getBone(), AttachUtils.getEquipPointRotationOffset(point.getOffsetRotation())); | ||||
|                         AttachUtils.clientAttachEntityToEntityAtBone(parent, toEquip, point.getBone(), AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationThirdPerson())); | ||||
|                         //make uncollidable | ||||
|                         if(toEquip.containsKey(EntityDataStrings.PHYSICS_COLLISION_BODY) && toEquip.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){ | ||||
|                             DBody rigidBody = (DBody)toEquip.getData(EntityDataStrings.PHYSICS_COLLISION_BODY); | ||||
| @ -148,9 +148,9 @@ public class ClientEquipState implements BehaviorTree { | ||||
|                 //does not depend on the type of creature, must be attaching to a bone | ||||
|                 equipMap.put(point.getEquipPointId(),toEquip); | ||||
|                 if(Globals.controlHandler.cameraIsThirdPerson()){ | ||||
|                     AttachUtils.clientAttachEntityToEntityAtBone(parent, toEquip, point.getBone(), AttachUtils.getEquipPointRotationOffset(point.getOffsetRotation())); | ||||
|                     AttachUtils.clientAttachEntityToEntityAtBone(parent, toEquip, point.getBone(), AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationThirdPerson())); | ||||
|                 } else { | ||||
|                     AttachUtils.clientAttachEntityToEntityAtBone(Globals.firstPersonEntity, toEquip, point.getFirstPersonBone(), AttachUtils.getEquipPointRotationOffset(point.getOffsetRotation())); | ||||
|                     AttachUtils.clientAttachEntityToEntityAtBone(Globals.firstPersonEntity, toEquip, point.getFirstPersonBone(), AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationFirstPerson())); | ||||
|                 } | ||||
|                 if(toEquip.containsKey(EntityDataStrings.PHYSICS_COLLISION_BODY) && toEquip.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){ | ||||
|                     DBody rigidBody = (DBody)toEquip.getData(EntityDataStrings.PHYSICS_COLLISION_BODY); | ||||
| @ -341,14 +341,14 @@ public class ClientEquipState implements BehaviorTree { | ||||
|                 EquipPoint point = this.getEquipPoint(occupiedPoint); | ||||
|                 Entity toEquip = this.equipMap.get(point.getEquipPointId()); | ||||
|                 AttachUtils.clientDetatchEntityFromEntityAtBone(Globals.firstPersonEntity, toEquip); | ||||
|                 AttachUtils.clientAttachEntityToEntityAtBone(Globals.playerEntity, toEquip, point.getBone(), AttachUtils.getEquipPointRotationOffset(point.getOffsetRotation())); | ||||
|                 AttachUtils.clientAttachEntityToEntityAtBone(Globals.playerEntity, toEquip, point.getBone(), AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationThirdPerson())); | ||||
|             } | ||||
|         } else { | ||||
|             for(String occupiedPoint : this.getEquippedPoints()){ | ||||
|                 EquipPoint point = this.getEquipPoint(occupiedPoint); | ||||
|                 Entity toEquip = this.equipMap.get(point.getEquipPointId()); | ||||
|                 AttachUtils.clientDetatchEntityFromEntityAtBone(Globals.playerEntity, toEquip); | ||||
|                 AttachUtils.clientAttachEntityToEntityAtBone(Globals.firstPersonEntity, toEquip, point.getFirstPersonBone(), AttachUtils.getEquipPointRotationOffset(point.getOffsetRotation())); | ||||
|                 AttachUtils.clientAttachEntityToEntityAtBone(Globals.firstPersonEntity, toEquip, point.getFirstPersonBone(), AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationFirstPerson())); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @ -114,7 +114,7 @@ public class ServerEquipState implements BehaviorTree { | ||||
|                         String modelName = whitelistItem.getModel(); | ||||
|                         Globals.assetManager.addModelPathToQueue(modelName); | ||||
|                         //attach to parent bone | ||||
|                         AttachUtils.serverAttachEntityToEntityAtBone(parent, inWorldItem, point.getBone(), AttachUtils.getEquipPointRotationOffset(point.getOffsetRotation())); | ||||
|                         AttachUtils.serverAttachEntityToEntityAtBone(parent, inWorldItem, point.getBone(), AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationThirdPerson())); | ||||
|                         //make uncollidable | ||||
|                         if(inWorldItem.containsKey(EntityDataStrings.PHYSICS_COLLISION_BODY) && inWorldItem.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){ | ||||
|                             DBody rigidBody = (DBody)inWorldItem.getData(EntityDataStrings.PHYSICS_COLLISION_BODY); | ||||
| @ -131,7 +131,7 @@ public class ServerEquipState implements BehaviorTree { | ||||
|             } else { | ||||
|                 //does not depend on the type of creature | ||||
|                 equipMap.put(point.getEquipPointId(),inWorldItem); | ||||
|                 AttachUtils.serverAttachEntityToEntityAtBone(parent, inWorldItem, point.getBone(), AttachUtils.getEquipPointRotationOffset(point.getOffsetRotation())); | ||||
|                 AttachUtils.serverAttachEntityToEntityAtBone(parent, inWorldItem, point.getBone(), AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationThirdPerson())); | ||||
|                 if(inWorldItem.containsKey(EntityDataStrings.PHYSICS_COLLISION_BODY) && inWorldItem.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){ | ||||
|                     DBody rigidBody = (DBody)inWorldItem.getData(EntityDataStrings.PHYSICS_COLLISION_BODY); | ||||
|                     Realm inWorldRealm = Globals.realmManager.getEntityRealm(inWorldItem); | ||||
|  | ||||
| @ -572,8 +572,9 @@ public class AttachUtils { | ||||
|      * @param parentEntity | ||||
|      * @return The list of entities that are attached to this parent entity, or null if undefined | ||||
|      */ | ||||
|     public static LinkedList<Entity> getChildrenList(Entity parentEntity){ | ||||
|         return (LinkedList<Entity>)parentEntity.getData(EntityDataStrings.ATTACH_CHILDREN_LIST); | ||||
|     @SuppressWarnings("unchecked") //as long as we only ever access this value via the getters and setters in this class, this assumption should always be correct | ||||
|     public static List<Entity> getChildrenList(Entity parentEntity){ | ||||
|         return (List<Entity>)parentEntity.getData(EntityDataStrings.ATTACH_CHILDREN_LIST); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|  | ||||
| @ -16,7 +16,9 @@ public class EquipPoint { | ||||
|     //the offset to apply to items that are attached to the bone | ||||
|     List<Float> offsetVector; | ||||
|     //the rotation to apply to the items that are attached to the bone | ||||
|     List<Float> offsetRotation; | ||||
|     List<Float> offsetRotationThirdPerson; | ||||
|     //the rotation to apply to the items that are attached to the view model's bone | ||||
|     List<Float> offsetRotationFirstPerson; | ||||
|     //signals that this equip point can block | ||||
|     boolean canBlock; | ||||
|     //the equip classes that are whitelisted for this equip point | ||||
| @ -55,19 +57,37 @@ public class EquipPoint { | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Gets the rotation to apply to the items that are attached to the bone | ||||
|      * [Third Person] | ||||
|      * Gets the rotation to apply to the items that are attached to the third person model's bone | ||||
|      * @return the rotation | ||||
|      */ | ||||
|     public List<Float> getOffsetRotation(){ | ||||
|         return offsetRotation; | ||||
|     public List<Float> getOffsetRotationThirdPerson(){ | ||||
|         return offsetRotationThirdPerson; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Sets the offset rotation (used primarily for debug and engine testing) | ||||
|      * @param offsetRotation The new offset rotation | ||||
|      */ | ||||
|     public void setOffsetRotation(List<Float> offsetRotation){ | ||||
|         this.offsetRotation = offsetRotation; | ||||
|     public void setOffsetRotationThirdPerson(List<Float> offsetRotation){ | ||||
|         this.offsetRotationThirdPerson = offsetRotation; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * [First Person] | ||||
|      * Gets the rotation to apply to the items that are attached to the view model's bone | ||||
|      * @return the rotation | ||||
|      */ | ||||
|     public List<Float> getOffsetRotationFirstPerson(){ | ||||
|         return offsetRotationFirstPerson; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Sets the offset rotation (used primarily for debug and engine testing) | ||||
|      * @param offsetRotation The new offset rotation | ||||
|      */ | ||||
|     public void setOffsetRotationFirstPerson(List<Float> offsetRotation){ | ||||
|         this.offsetRotationFirstPerson = offsetRotation; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|  | ||||
| @ -161,7 +161,10 @@ public class ImGuiEntityMacros { | ||||
|         equipStateView.setCallback(new ImGuiWindowCallback() { | ||||
| 
 | ||||
|             //stores the edited rotation values | ||||
|             float[] rotationValues = new float[]{ | ||||
|             float[] rotationValuesFirstPerson = new float[]{ | ||||
|                 0,0,0 | ||||
|             }; | ||||
|             float[] rotationValuesThirdPerson = new float[]{ | ||||
|                 0,0,0 | ||||
|             }; | ||||
| 
 | ||||
| @ -176,18 +179,32 @@ public class ImGuiEntityMacros { | ||||
|                                 ImGui.text("Has item equipped: " + (clientEquipState.getEquippedItemAtPoint(point.getEquipPointId()) != null)); | ||||
|                                 ImGui.text("Bone (Third Person): " + point.getBone()); | ||||
|                                 ImGui.text("Bone (First Person): " + point.getFirstPersonBone()); | ||||
|                                 ImGui.text("Rotation: " + AttachUtils.getEquipPointRotationOffset(point.getOffsetRotation())); | ||||
|                                 if(ImGui.sliderFloat3("Rotation (In Euler along x,y,z)", rotationValues, 0, (float)(Math.PI * 2))){ | ||||
|                                     Quaterniond rotation = new Quaterniond().rotateXYZ(rotationValues[0], rotationValues[1], rotationValues[2]); | ||||
|                                 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.setOffsetRotation(newValues); | ||||
|                                     point.setOffsetRotationThirdPerson(newValues); | ||||
|                                     Entity equippedEntity = clientEquipState.getEquippedItemAtPoint(point.getEquipPointId()); | ||||
|                                     if(equippedEntity != null){ | ||||
|                                         AttachUtils.setRotationOffset(equippedEntity, AttachUtils.getEquipPointRotationOffset(point.getOffsetRotation())); | ||||
|                                         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))){ | ||||
|                                     Quaterniond rotation = new Quaterniond().rotateXYZ(rotationValuesFirstPerson[0], rotationValuesFirstPerson[1], rotationValuesFirstPerson[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.setOffsetRotationFirstPerson(newValues); | ||||
|                                     Entity equippedEntity = clientEquipState.getEquippedItemAtPoint(point.getEquipPointId()); | ||||
|                                     if(equippedEntity != null){ | ||||
|                                         AttachUtils.setRotationOffset(equippedEntity, AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationFirstPerson())); | ||||
|                                     } | ||||
|                                 } | ||||
|                             } | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user