first person attach 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
							
								
									c5f16ae282
								
							
						
					
					
						commit
						6d3a8f159b
					
				| @ -243,8 +243,10 @@ | |||||||
|                     "equipPointId" : "handLeft", |                     "equipPointId" : "handLeft", | ||||||
|                     "bone" : "Hand.L", |                     "bone" : "Hand.L", | ||||||
|                     "firstPersonBone" : "hand.L", |                     "firstPersonBone" : "hand.L", | ||||||
|                     "offsetVector" : [0,0,0], |                     "offsetVectorFirstPerson" : [0,0,0], | ||||||
|                     "offsetRotation" : [0,0,0,1], |                     "offsetVectorThirdPerson" : [0,0,0], | ||||||
|  |                     "offsetRotationFirstPerson" : [0,0,0,1], | ||||||
|  |                     "offsetRotationThirdPerson" : [0,0,0,1], | ||||||
|                     "equipClassWhitelist" : [ |                     "equipClassWhitelist" : [ | ||||||
|                         "tool", |                         "tool", | ||||||
|                         "shield", |                         "shield", | ||||||
| @ -255,7 +257,8 @@ | |||||||
|                     "equipPointId" : "handRight", |                     "equipPointId" : "handRight", | ||||||
|                     "bone" : "Hand.R", |                     "bone" : "Hand.R", | ||||||
|                     "firstPersonBone" : "hand.R", |                     "firstPersonBone" : "hand.R", | ||||||
|                     "offsetVector" : [0,0,0], |                     "offsetVectorFirstPerson" : [0,0,0], | ||||||
|  |                     "offsetVectorThirdPerson" : [0.02,-0.06,0], | ||||||
|                     "offsetRotationThirdPerson" : [-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], |                     "offsetRotationFirstPerson" : [0.923,-0.143,-0.232,0.24], | ||||||
|                     "canBlock" : true, |                     "canBlock" : true, | ||||||
| @ -268,8 +271,10 @@ | |||||||
|                 { |                 { | ||||||
|                     "equipPointId" : "Torso", |                     "equipPointId" : "Torso", | ||||||
|                     "bone" : "Bone", |                     "bone" : "Bone", | ||||||
|                     "offsetVector" : [], |                     "offsetVectorFirstPerson" : [0,0,0], | ||||||
|                     "offsetRotation" : [], |                     "offsetVectorThirdPerson" : [0,0,0], | ||||||
|  |                     "offsetRotationFirstPerson" : [0,0,0,1], | ||||||
|  |                     "offsetRotationThirdPerson" : [0,0,0,1], | ||||||
|                     "equipClassWhitelist" : [ |                     "equipClassWhitelist" : [ | ||||||
|                         "armor", |                         "armor", | ||||||
|                         "clothing" |                         "clothing" | ||||||
| @ -278,8 +283,10 @@ | |||||||
|                 { |                 { | ||||||
|                     "equipPointId" : "Legs", |                     "equipPointId" : "Legs", | ||||||
|                     "bone" : "Bone", |                     "bone" : "Bone", | ||||||
|                     "offsetVector" : [], |                     "offsetVectorFirstPerson" : [0,0,0], | ||||||
|                     "offsetRotation" : [], |                     "offsetVectorThirdPerson" : [0,0,0], | ||||||
|  |                     "offsetRotationFirstPerson" : [0,0,0,1], | ||||||
|  |                     "offsetRotationThirdPerson" : [0,0,0,1], | ||||||
|                     "equipClassWhitelist" : [ |                     "equipClassWhitelist" : [ | ||||||
|                         "armor", |                         "armor", | ||||||
|                         "clothing" |                         "clothing" | ||||||
|  | |||||||
| @ -462,6 +462,12 @@ Refactor spawn point to not be global | |||||||
| Synchronize objects between client and server | Synchronize objects between client and server | ||||||
| Synchronize life state between client and server | Synchronize life state between client and server | ||||||
| 
 | 
 | ||||||
|  | (07/27/2024) | ||||||
|  | Small bugfix with blocking | ||||||
|  | Refactor math to be client/server agnostic in attach utils | ||||||
|  | Attach utils fixes for first person handling | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| # TODO | # TODO | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -72,9 +72,11 @@ public class ServerBlockTree implements BehaviorTree { | |||||||
|      * Starts the block tree |      * Starts the block tree | ||||||
|      */ |      */ | ||||||
|     public void start(){ |     public void start(){ | ||||||
|  |         if(this.currentBlockVariant != null && this.blockSystem.getBlockVariant(this.currentBlockVariant) != null){ | ||||||
|             this.stateTransitionUtil.reset(); |             this.stateTransitionUtil.reset(); | ||||||
|             setState(BlockState.WIND_UP); |             setState(BlockState.WIND_UP); | ||||||
|         } |         } | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Stops the block tree |      * Stops the block tree | ||||||
|  | |||||||
| @ -131,7 +131,23 @@ public class ClientEquipState implements BehaviorTree { | |||||||
|                             meshMask.queueMesh(modelName, toDraw); |                             meshMask.queueMesh(modelName, toDraw); | ||||||
|                         } |                         } | ||||||
|                         //attach to parent bone |                         //attach to parent bone | ||||||
|                         AttachUtils.clientAttachEntityToEntityAtBone(parent, toEquip, point.getBone(), AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationThirdPerson())); |                         if(parent != Globals.firstPersonEntity || Globals.controlHandler.cameraIsThirdPerson()){ | ||||||
|  |                             AttachUtils.clientAttachEntityToEntityAtBone( | ||||||
|  |                                 parent, | ||||||
|  |                                 toEquip, | ||||||
|  |                                 point.getBone(), | ||||||
|  |                                 AttachUtils.getEquipPointVectorOffset(point.getOffsetVectorThirdPerson()), | ||||||
|  |                                 AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationThirdPerson()) | ||||||
|  |                             ); | ||||||
|  |                         } else { | ||||||
|  |                             AttachUtils.clientAttachEntityToEntityAtBone( | ||||||
|  |                                 Globals.firstPersonEntity, | ||||||
|  |                                 toEquip, | ||||||
|  |                                 point.getFirstPersonBone(), | ||||||
|  |                                 AttachUtils.getEquipPointVectorOffset(point.getOffsetVectorFirstPerson()), | ||||||
|  |                                 AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationFirstPerson()) | ||||||
|  |                             ); | ||||||
|  |                         } | ||||||
|                         //make uncollidable |                         //make uncollidable | ||||||
|                         if(toEquip.containsKey(EntityDataStrings.PHYSICS_COLLISION_BODY) && toEquip.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){ |                         if(toEquip.containsKey(EntityDataStrings.PHYSICS_COLLISION_BODY) && toEquip.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){ | ||||||
|                             DBody rigidBody = (DBody)toEquip.getData(EntityDataStrings.PHYSICS_COLLISION_BODY); |                             DBody rigidBody = (DBody)toEquip.getData(EntityDataStrings.PHYSICS_COLLISION_BODY); | ||||||
| @ -147,10 +163,22 @@ public class ClientEquipState implements BehaviorTree { | |||||||
|             } else { |             } else { | ||||||
|                 //does not depend on the type of creature, must be attaching to a bone |                 //does not depend on the type of creature, must be attaching to a bone | ||||||
|                 equipMap.put(point.getEquipPointId(),toEquip); |                 equipMap.put(point.getEquipPointId(),toEquip); | ||||||
|                 if(Globals.controlHandler.cameraIsThirdPerson()){ |                 if(parent != Globals.firstPersonEntity ||  Globals.controlHandler.cameraIsThirdPerson()){ | ||||||
|                     AttachUtils.clientAttachEntityToEntityAtBone(parent, toEquip, point.getBone(), AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationThirdPerson())); |                     AttachUtils.clientAttachEntityToEntityAtBone( | ||||||
|  |                         parent, | ||||||
|  |                         toEquip, | ||||||
|  |                         point.getBone(), | ||||||
|  |                         AttachUtils.getEquipPointVectorOffset(point.getOffsetVectorThirdPerson()), | ||||||
|  |                         AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationThirdPerson()) | ||||||
|  |                     ); | ||||||
|                 } else { |                 } else { | ||||||
|                     AttachUtils.clientAttachEntityToEntityAtBone(Globals.firstPersonEntity, toEquip, point.getFirstPersonBone(), AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationFirstPerson())); |                     AttachUtils.clientAttachEntityToEntityAtBone( | ||||||
|  |                         Globals.firstPersonEntity, | ||||||
|  |                         toEquip, | ||||||
|  |                         point.getFirstPersonBone(), | ||||||
|  |                         AttachUtils.getEquipPointVectorOffset(point.getOffsetVectorFirstPerson()), | ||||||
|  |                         AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationFirstPerson()) | ||||||
|  |                     ); | ||||||
|                 } |                 } | ||||||
|                 if(toEquip.containsKey(EntityDataStrings.PHYSICS_COLLISION_BODY) && toEquip.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){ |                 if(toEquip.containsKey(EntityDataStrings.PHYSICS_COLLISION_BODY) && toEquip.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){ | ||||||
|                     DBody rigidBody = (DBody)toEquip.getData(EntityDataStrings.PHYSICS_COLLISION_BODY); |                     DBody rigidBody = (DBody)toEquip.getData(EntityDataStrings.PHYSICS_COLLISION_BODY); | ||||||
| @ -342,7 +370,13 @@ public class ClientEquipState implements BehaviorTree { | |||||||
|                 Entity toEquip = this.equipMap.get(point.getEquipPointId()); |                 Entity toEquip = this.equipMap.get(point.getEquipPointId()); | ||||||
|                 if(AttachUtils.getParent(toEquip) != Globals.playerEntity){ |                 if(AttachUtils.getParent(toEquip) != Globals.playerEntity){ | ||||||
|                     AttachUtils.clientDetatchEntityFromEntityAtBone(Globals.firstPersonEntity, toEquip); |                     AttachUtils.clientDetatchEntityFromEntityAtBone(Globals.firstPersonEntity, toEquip); | ||||||
|                     AttachUtils.clientAttachEntityToEntityAtBone(Globals.playerEntity, toEquip, point.getBone(), AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationThirdPerson())); |                     AttachUtils.clientAttachEntityToEntityAtBone( | ||||||
|  |                         Globals.playerEntity, | ||||||
|  |                         toEquip, | ||||||
|  |                         point.getBone(), | ||||||
|  |                         AttachUtils.getEquipPointVectorOffset(point.getOffsetVectorThirdPerson()), | ||||||
|  |                         AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationThirdPerson()) | ||||||
|  |                     ); | ||||||
|                 } else { |                 } else { | ||||||
|                     AttachUtils.clientUpdateEntityTransforms(toEquip, Globals.playerEntity); |                     AttachUtils.clientUpdateEntityTransforms(toEquip, Globals.playerEntity); | ||||||
|                 } |                 } | ||||||
| @ -353,7 +387,13 @@ public class ClientEquipState implements BehaviorTree { | |||||||
|                 Entity toEquip = this.equipMap.get(point.getEquipPointId()); |                 Entity toEquip = this.equipMap.get(point.getEquipPointId()); | ||||||
|                 if(AttachUtils.getParent(toEquip) != Globals.firstPersonEntity){ |                 if(AttachUtils.getParent(toEquip) != Globals.firstPersonEntity){ | ||||||
|                     AttachUtils.clientDetatchEntityFromEntityAtBone(Globals.playerEntity, toEquip); |                     AttachUtils.clientDetatchEntityFromEntityAtBone(Globals.playerEntity, toEquip); | ||||||
|                     AttachUtils.clientAttachEntityToEntityAtBone(Globals.firstPersonEntity, toEquip, point.getFirstPersonBone(), AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationFirstPerson())); |                     AttachUtils.clientAttachEntityToEntityAtBone( | ||||||
|  |                         Globals.firstPersonEntity, | ||||||
|  |                         toEquip, | ||||||
|  |                         point.getFirstPersonBone(), | ||||||
|  |                         AttachUtils.getEquipPointVectorOffset(point.getOffsetVectorFirstPerson()), | ||||||
|  |                         AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationFirstPerson()) | ||||||
|  |                     ); | ||||||
|                 } else { |                 } else { | ||||||
|                     AttachUtils.clientUpdateEntityTransforms(toEquip, Globals.firstPersonEntity); |                     AttachUtils.clientUpdateEntityTransforms(toEquip, Globals.firstPersonEntity); | ||||||
|                 } |                 } | ||||||
|  | |||||||
| @ -116,7 +116,13 @@ public class ServerEquipState implements BehaviorTree { | |||||||
|                         String modelName = whitelistItem.getModel(); |                         String modelName = whitelistItem.getModel(); | ||||||
|                         Globals.assetManager.addModelPathToQueue(modelName); |                         Globals.assetManager.addModelPathToQueue(modelName); | ||||||
|                         //attach to parent bone |                         //attach to parent bone | ||||||
|                         AttachUtils.serverAttachEntityToEntityAtBone(parent, inWorldItem, point.getBone(), AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationThirdPerson())); |                         AttachUtils.serverAttachEntityToEntityAtBone( | ||||||
|  |                             parent, | ||||||
|  |                             inWorldItem, | ||||||
|  |                             point.getBone(), | ||||||
|  |                             AttachUtils.getEquipPointVectorOffset(point.getOffsetVectorThirdPerson()), | ||||||
|  |                             AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationThirdPerson()) | ||||||
|  |                         ); | ||||||
|                         //make uncollidable |                         //make uncollidable | ||||||
|                         if(inWorldItem.containsKey(EntityDataStrings.PHYSICS_COLLISION_BODY) && inWorldItem.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){ |                         if(inWorldItem.containsKey(EntityDataStrings.PHYSICS_COLLISION_BODY) && inWorldItem.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){ | ||||||
|                             DBody rigidBody = (DBody)inWorldItem.getData(EntityDataStrings.PHYSICS_COLLISION_BODY); |                             DBody rigidBody = (DBody)inWorldItem.getData(EntityDataStrings.PHYSICS_COLLISION_BODY); | ||||||
| @ -133,7 +139,13 @@ public class ServerEquipState implements BehaviorTree { | |||||||
|             } else { |             } else { | ||||||
|                 //does not depend on the type of creature |                 //does not depend on the type of creature | ||||||
|                 equipMap.put(point.getEquipPointId(),inWorldItem); |                 equipMap.put(point.getEquipPointId(),inWorldItem); | ||||||
|                 AttachUtils.serverAttachEntityToEntityAtBone(parent, inWorldItem, point.getBone(), AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationThirdPerson())); |                 AttachUtils.serverAttachEntityToEntityAtBone( | ||||||
|  |                     parent, | ||||||
|  |                     inWorldItem, | ||||||
|  |                     point.getBone(), | ||||||
|  |                     AttachUtils.getEquipPointVectorOffset(point.getOffsetVectorThirdPerson()), | ||||||
|  |                     AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationThirdPerson()) | ||||||
|  |                 ); | ||||||
|                 if(inWorldItem.containsKey(EntityDataStrings.PHYSICS_COLLISION_BODY) && inWorldItem.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){ |                 if(inWorldItem.containsKey(EntityDataStrings.PHYSICS_COLLISION_BODY) && inWorldItem.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){ | ||||||
|                     DBody rigidBody = (DBody)inWorldItem.getData(EntityDataStrings.PHYSICS_COLLISION_BODY); |                     DBody rigidBody = (DBody)inWorldItem.getData(EntityDataStrings.PHYSICS_COLLISION_BODY); | ||||||
|                     Realm inWorldRealm = Globals.realmManager.getEntityRealm(inWorldItem); |                     Realm inWorldRealm = Globals.realmManager.getEntityRealm(inWorldItem); | ||||||
|  | |||||||
| @ -63,32 +63,31 @@ public class AttachUtils { | |||||||
|             Entity parent; |             Entity parent; | ||||||
|             if((parent = (Entity)currentEntity.getData(EntityDataStrings.ATTACH_PARENT))!=null){ |             if((parent = (Entity)currentEntity.getData(EntityDataStrings.ATTACH_PARENT))!=null){ | ||||||
|                 String targetBone; |                 String targetBone; | ||||||
|                 if((targetBone = (String)currentEntity.getData(EntityDataStrings.ATTACH_TARGET_BONE))!=null){ |                 if((targetBone = getTargetBone(currentEntity))!=null){ | ||||||
|                     PoseActor parentActor = EntityUtils.getPoseActor(parent); |                     PoseActor parentActor = EntityUtils.getPoseActor(parent); | ||||||
|                     //get offset rotation |  | ||||||
|                     Quaterniond offsetRotation = getRotationOffset(currentEntity); |  | ||||||
|                     //transform bone space |  | ||||||
|                     Vector3d position = new Vector3d(parentActor.getBonePosition(targetBone)); |  | ||||||
|                     position = position.mul(((Vector3f)EntityUtils.getScale(parent))); |  | ||||||
|                     Quaterniond rotation = EntityUtils.getRotation(parent); |  | ||||||
|                     position = position.rotate(new Quaterniond(rotation.x,rotation.y,rotation.z,rotation.w)); |  | ||||||
|                     //transform worldspace |  | ||||||
|                     position.add(new Vector3d(EntityUtils.getPosition(parent))); |  | ||||||
|                     //set |  | ||||||
|                     EntityUtils.getPosition(currentEntity).set(position); |  | ||||||
|                     //set rotation |                     //set rotation | ||||||
| //                    Quaternionf rotation = parentActor.getBoneRotation(targetBone); |  | ||||||
| //                    EntityUtils.getRotation(currentEntity).set(rotation).normalize(); |  | ||||||
|                     Vector3d facingAngle = CreatureUtils.getFacingVector(parent); |                     Vector3d facingAngle = CreatureUtils.getFacingVector(parent); | ||||||
|                     //calculate rotation of model | 
 | ||||||
|                     EntityUtils.getRotation(currentEntity) |                     //manual offset | ||||||
|                         .rotationTo(MathUtils.getOriginVector(), new Vector3d(facingAngle.x,facingAngle.y,facingAngle.z)) |                     Vector3d offset = AttachUtils.getVectorOffset(currentEntity); | ||||||
|                         .mul(parentActor.getBoneRotation(targetBone)) |                     if(offset == null){ | ||||||
|                         .mul(offsetRotation) |                         offset = new Vector3d(); | ||||||
|                         .normalize(); |                     } | ||||||
|  | 
 | ||||||
|  |                     calculateEntityTransforms( | ||||||
|  |                         currentEntity, | ||||||
|  |                         new Vector3d(offset), | ||||||
|  |                         new Quaterniond(AttachUtils.getRotationOffset(currentEntity)), | ||||||
|  |                         new Vector3d(parentActor.getBonePosition(targetBone)), | ||||||
|  |                         new Quaterniond(parentActor.getBoneRotation(targetBone)), | ||||||
|  |                         new Vector3d(EntityUtils.getPosition(parent)), | ||||||
|  |                         new Quaterniond(EntityUtils.getRotation(parent)), | ||||||
|  |                         new Vector3d(EntityUtils.getScale(parent)), | ||||||
|  |                         new Vector3d(facingAngle) | ||||||
|  |                     ); | ||||||
|                 } |                 } | ||||||
|             } else if(currentEntity.getData(EntityDataStrings.ATTACH_TARGET_BASE)!=null){ |             } else if(currentEntity.getData(EntityDataStrings.ATTACH_TARGET_BASE)!=null){ | ||||||
|                 Vector3d positionOffset = getAttachPositionOffset(currentEntity); |                 Vector3d positionOffset = getVectorOffset(currentEntity); | ||||||
|                 Vector3d parentPosition = EntityUtils.getPosition(parent); |                 Vector3d parentPosition = EntityUtils.getPosition(parent); | ||||||
|                 EntityUtils.getPosition(currentEntity).set(new Vector3d(parentPosition).add(positionOffset)); |                 EntityUtils.getPosition(currentEntity).set(new Vector3d(parentPosition).add(positionOffset)); | ||||||
|             } |             } | ||||||
| @ -184,7 +183,7 @@ public class AttachUtils { | |||||||
|             if((parent = (Entity)currentEntity.getData(EntityDataStrings.ATTACH_PARENT))!=null){ |             if((parent = (Entity)currentEntity.getData(EntityDataStrings.ATTACH_PARENT))!=null){ | ||||||
|                 clientUpdateEntityTransforms(currentEntity,parent); |                 clientUpdateEntityTransforms(currentEntity,parent); | ||||||
|             } else if(currentEntity.getData(EntityDataStrings.ATTACH_TARGET_BASE)!=null){ |             } else if(currentEntity.getData(EntityDataStrings.ATTACH_TARGET_BASE)!=null){ | ||||||
|                 Vector3d positionOffset = getAttachPositionOffset(currentEntity); |                 Vector3d positionOffset = getVectorOffset(currentEntity); | ||||||
|                 Vector3d parentPosition = EntityUtils.getPosition(parent); |                 Vector3d parentPosition = EntityUtils.getPosition(parent); | ||||||
|                 EntityUtils.getPosition(currentEntity).set(new Vector3d(parentPosition).add(positionOffset)); |                 EntityUtils.getPosition(currentEntity).set(new Vector3d(parentPosition).add(positionOffset)); | ||||||
|             } |             } | ||||||
| @ -199,37 +198,33 @@ public class AttachUtils { | |||||||
|      */ |      */ | ||||||
|     public static void clientUpdateEntityTransforms(Entity child, Entity parent){ |     public static void clientUpdateEntityTransforms(Entity child, Entity parent){ | ||||||
|         String targetBone; |         String targetBone; | ||||||
|         if((targetBone = (String)child.getData(EntityDataStrings.ATTACH_TARGET_BONE))!=null){ |         if((targetBone = getTargetBone(child))!=null){ | ||||||
|             Actor parentActor = EntityUtils.getActor(parent); |             Actor parentActor = EntityUtils.getActor(parent); | ||||||
|             //get offset rotation | 
 | ||||||
|             Quaterniond offsetRotation = getRotationOffset(child); |  | ||||||
|             //transform bone space |  | ||||||
|             Vector3d position = new Vector3d(parentActor.getBonePosition(targetBone)); |  | ||||||
|             position = position.mul(((Vector3f)EntityUtils.getScale(parent))); |  | ||||||
|             Quaterniond rotation = EntityUtils.getRotation(parent); |  | ||||||
|             position = position.rotate(new Quaterniond(rotation.x,rotation.y,rotation.z,rotation.w)); |  | ||||||
|             //transform worldspace |  | ||||||
|             position.add(new Vector3d(EntityUtils.getPosition(parent))); |  | ||||||
|             //set |  | ||||||
|             EntityUtils.getPosition(child).set(position); |  | ||||||
|             //set rotation |  | ||||||
| //                    Quaternionf rotation = parentActor.getBoneRotation(targetBone); |  | ||||||
| //                    EntityUtils.getRotation(currentEntity).set(rotation).normalize(); |  | ||||||
|             Vector3d facingAngle; |             Vector3d facingAngle; | ||||||
|             if(parent == Globals.firstPersonEntity){ |             if(parent == Globals.firstPersonEntity){ | ||||||
|                 facingAngle = CreatureUtils.getFacingVector(Globals.playerEntity); |                 facingAngle = CreatureUtils.getFacingVector(Globals.playerEntity); | ||||||
|             } else { |             } else { | ||||||
|                 facingAngle = CreatureUtils.getFacingVector(parent); |                 facingAngle = CreatureUtils.getFacingVector(parent); | ||||||
|             } |             } | ||||||
|             if(facingAngle == null){ | 
 | ||||||
|                 facingAngle = MathUtils.getOriginVector(); |             //manual offset | ||||||
|  |             Vector3d offset = AttachUtils.getVectorOffset(child); | ||||||
|  |             if(offset == null){ | ||||||
|  |                 offset = new Vector3d(); | ||||||
|             } |             } | ||||||
|             //calculate rotation of model | 
 | ||||||
|             EntityUtils.getRotation(child) |             calculateEntityTransforms( | ||||||
|                 .rotationTo(MathUtils.getOriginVector(), new Vector3d(facingAngle.x,facingAngle.y,facingAngle.z)) |                 child, | ||||||
|                 .mul(parentActor.getBoneRotation(targetBone)) |                 new Vector3d(offset), | ||||||
|                 .mul(offsetRotation) |                 new Quaterniond(AttachUtils.getRotationOffset(child)), | ||||||
|                 .normalize(); |                 new Vector3d(parentActor.getBonePosition(targetBone)), | ||||||
|  |                 new Quaterniond(parentActor.getBoneRotation(targetBone)), | ||||||
|  |                 new Vector3d(EntityUtils.getPosition(parent)), | ||||||
|  |                 new Quaterniond(EntityUtils.getRotation(parent)), | ||||||
|  |                 new Vector3d(EntityUtils.getScale(parent)), | ||||||
|  |                 new Vector3d(facingAngle) | ||||||
|  |             ); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @ -285,6 +280,56 @@ public class AttachUtils { | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |     /// | ||||||
|  |     ///    MATH | ||||||
|  |     /// | ||||||
|  |     /** | ||||||
|  |      * Updates the spatial data for the attached entity | ||||||
|  |      * @param child The entity that is attached to a parent | ||||||
|  |      * @param parent The parent entity that has a child attached to it | ||||||
|  |      */ | ||||||
|  |     public static void calculateEntityTransforms( | ||||||
|  |         Entity child, | ||||||
|  |          | ||||||
|  |         //optional offsets | ||||||
|  |         Vector3d offsetVector, | ||||||
|  |         Quaterniond offsetRotation, | ||||||
|  | 
 | ||||||
|  |         //current bone transform | ||||||
|  |         Vector3d bonePosition, | ||||||
|  |         Quaterniond boneRotation, | ||||||
|  | 
 | ||||||
|  |         //parent transforms | ||||||
|  |         Vector3d parentPosition, | ||||||
|  |         Quaterniond parentRotation, | ||||||
|  |         Vector3d parentScale, | ||||||
|  | 
 | ||||||
|  |         //the parent's facing vector | ||||||
|  |         Vector3d facingVector | ||||||
|  |     ){ | ||||||
|  |         //transform bone space | ||||||
|  |         Vector3d position = new Vector3d(bonePosition); | ||||||
|  |         position = position.mul(parentScale); | ||||||
|  |         position = position.rotate(new Quaterniond(parentRotation.x,parentRotation.y,parentRotation.z,parentRotation.w)); | ||||||
|  |         position = position.add(offsetVector); | ||||||
|  |         //transform worldspace | ||||||
|  |         position.add(parentPosition); | ||||||
|  |         //set | ||||||
|  |         EntityUtils.getPosition(child).set(position); | ||||||
|  |         //set rotation | ||||||
|  |         Vector3d facingAngle = facingVector; | ||||||
|  |         if(facingAngle == null){ | ||||||
|  |             facingAngle = MathUtils.getOriginVector(); | ||||||
|  |         } | ||||||
|  |         //calculate rotation of model | ||||||
|  |         EntityUtils.getRotation(child) | ||||||
|  |             .rotationTo(MathUtils.getOriginVector(), new Vector3d(facingAngle.x,facingAngle.y,facingAngle.z)) | ||||||
|  |             .mul(boneRotation) | ||||||
|  |             .mul(offsetRotation) | ||||||
|  |             .normalize(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @ -303,12 +348,13 @@ public class AttachUtils { | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     public static void serverAttachEntityToEntityAtBone(Entity parent, Entity toAttach, String boneName, Quaterniond rotation){ |     public static void serverAttachEntityToEntityAtBone(Entity parent, Entity toAttach, String boneName, Vector3d offset, Quaterniond rotation){ | ||||||
|         ServerEntityTagUtils.attachTagToEntity(toAttach, EntityTags.BONE_ATTACHED); |         ServerEntityTagUtils.attachTagToEntity(toAttach, EntityTags.BONE_ATTACHED); | ||||||
|         toAttach.putData(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED, true); |         toAttach.putData(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED, true); | ||||||
|         toAttach.putData(EntityDataStrings.ATTACH_PARENT, parent); |         toAttach.putData(EntityDataStrings.ATTACH_PARENT, parent); | ||||||
|         toAttach.putData(EntityDataStrings.ATTACH_TARGET_BONE, boneName); |         toAttach.putData(EntityDataStrings.ATTACH_TARGET_BONE, boneName); | ||||||
|         toAttach.putData(EntityDataStrings.ATTACH_ROTATION_OFFSET, rotation); |         AttachUtils.setVectorOffset(toAttach, offset); | ||||||
|  |         AttachUtils.setRotationOffset(toAttach, rotation); | ||||||
|         if(parent.containsKey(EntityDataStrings.ATTACH_CHILDREN_LIST)){ |         if(parent.containsKey(EntityDataStrings.ATTACH_CHILDREN_LIST)){ | ||||||
|             getChildrenList(parent).add(toAttach); |             getChildrenList(parent).add(toAttach); | ||||||
|         } else { |         } else { | ||||||
| @ -326,12 +372,13 @@ public class AttachUtils { | |||||||
|      * @param boneName The name of the bone |      * @param boneName The name of the bone | ||||||
|      * @param rotation The rotation applied |      * @param rotation The rotation applied | ||||||
|      */ |      */ | ||||||
|     public static void clientAttachEntityToEntityAtBone(Entity parent, Entity toAttach, String boneName, Quaterniond rotation){ |     public static void clientAttachEntityToEntityAtBone(Entity parent, Entity toAttach, String boneName, Vector3d offset, Quaterniond rotation){ | ||||||
|         Globals.clientSceneWrapper.getScene().registerEntityToTag(toAttach, EntityTags.BONE_ATTACHED); |         Globals.clientSceneWrapper.getScene().registerEntityToTag(toAttach, EntityTags.BONE_ATTACHED); | ||||||
|         toAttach.putData(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED, true); |         toAttach.putData(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED, true); | ||||||
|         toAttach.putData(EntityDataStrings.ATTACH_PARENT, parent); |         toAttach.putData(EntityDataStrings.ATTACH_PARENT, parent); | ||||||
|         toAttach.putData(EntityDataStrings.ATTACH_TARGET_BONE, boneName); |         toAttach.putData(EntityDataStrings.ATTACH_TARGET_BONE, boneName); | ||||||
|         toAttach.putData(EntityDataStrings.ATTACH_ROTATION_OFFSET, rotation); |         AttachUtils.setVectorOffset(toAttach, offset); | ||||||
|  |         AttachUtils.setRotationOffset(toAttach, rotation); | ||||||
|         if(parent.containsKey(EntityDataStrings.ATTACH_CHILDREN_LIST)){ |         if(parent.containsKey(EntityDataStrings.ATTACH_CHILDREN_LIST)){ | ||||||
|             getChildrenList(parent).add(toAttach); |             getChildrenList(parent).add(toAttach); | ||||||
|         } else { |         } else { | ||||||
| @ -357,7 +404,7 @@ public class AttachUtils { | |||||||
|         toAttach.putData(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED, true); |         toAttach.putData(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED, true); | ||||||
|         toAttach.putData(EntityDataStrings.ATTACH_PARENT, parent); |         toAttach.putData(EntityDataStrings.ATTACH_PARENT, parent); | ||||||
|         toAttach.putData(EntityDataStrings.ATTACH_TARGET_BASE, true); |         toAttach.putData(EntityDataStrings.ATTACH_TARGET_BASE, true); | ||||||
|         toAttach.putData(EntityDataStrings.ATTACH_POSITION_OFFSET, offset); |         setVectorOffset(parent, offset); | ||||||
|         if(parent.containsKey(EntityDataStrings.ATTACH_CHILDREN_LIST)){ |         if(parent.containsKey(EntityDataStrings.ATTACH_CHILDREN_LIST)){ | ||||||
|             getChildrenList(parent).add(toAttach); |             getChildrenList(parent).add(toAttach); | ||||||
|         } else { |         } else { | ||||||
| @ -524,10 +571,20 @@ public class AttachUtils { | |||||||
|         return e.containsKey(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED); |         return e.containsKey(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED); | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     /** | ||||||
|  |      * Gets the target bone | ||||||
|  |      * @param e The entity | ||||||
|  |      * @return The target bone | ||||||
|  |      */ | ||||||
|     public static String getTargetBone(Entity e){ |     public static String getTargetBone(Entity e){ | ||||||
|         return (String)e.getData(EntityDataStrings.ATTACH_TARGET_BONE); |         return (String)e.getData(EntityDataStrings.ATTACH_TARGET_BONE); | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     /** | ||||||
|  |      * Gets the parent entity this child is attached to | ||||||
|  |      * @param e The child entity | ||||||
|  |      * @return The parent entity | ||||||
|  |      */ | ||||||
|     public static Entity getParent(Entity e){ |     public static Entity getParent(Entity e){ | ||||||
|         return (Entity)e.getData(EntityDataStrings.ATTACH_PARENT); |         return (Entity)e.getData(EntityDataStrings.ATTACH_PARENT); | ||||||
|     } |     } | ||||||
| @ -550,6 +607,24 @@ public class AttachUtils { | |||||||
|         e.putData(EntityDataStrings.ATTACH_ROTATION_OFFSET, rotation); |         e.putData(EntityDataStrings.ATTACH_ROTATION_OFFSET, rotation); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * Gets the vector offset for an attachment | ||||||
|  |      * @param e The entity | ||||||
|  |      * @return The offset | ||||||
|  |      */ | ||||||
|  |     protected static Vector3d getVectorOffset(Entity e){ | ||||||
|  |         return (Vector3d)e.getData(EntityDataStrings.ATTACH_POSITION_OFFSET); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Sets the vector offset for an attachment | ||||||
|  |      * @param e The entity | ||||||
|  |      * @param offset The offset | ||||||
|  |      */ | ||||||
|  |     public static void setVectorOffset(Entity e, Vector3d offset){ | ||||||
|  |         e.putData(EntityDataStrings.ATTACH_POSITION_OFFSET,offset); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     /** |     /** | ||||||
|      * Gets the transform for a transform attached entity |      * Gets the transform for a transform attached entity | ||||||
|      * @param e The entity |      * @param e The entity | ||||||
| @ -568,15 +643,6 @@ public class AttachUtils { | |||||||
|         return e.containsKey(EntityDataStrings.ATTACH_CHILDREN_LIST) && !getChildrenList(e).isEmpty(); |         return e.containsKey(EntityDataStrings.ATTACH_CHILDREN_LIST) && !getChildrenList(e).isEmpty(); | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     /** |  | ||||||
|      * Gets the attached entity's posiiton offset |  | ||||||
|      * @param e The attached entity |  | ||||||
|      * @return The position offset |  | ||||||
|      */ |  | ||||||
|     public static Vector3d getAttachPositionOffset(Entity e){ |  | ||||||
|         return (Vector3d)e.getData(EntityDataStrings.ATTACH_POSITION_OFFSET); |  | ||||||
|     } |  | ||||||
|      |  | ||||||
|     /** |     /** | ||||||
|      * Gets the list of entities attached to this parent entity |      * Gets the list of entities attached to this parent entity | ||||||
|      * <p> |      * <p> | ||||||
| @ -604,4 +670,17 @@ public class AttachUtils { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * Gets the equip point's vector offset in vector form | ||||||
|  |      * @param values The list of raw float values | ||||||
|  |      * @return The vector containing those values or an identity vector if no such values exist | ||||||
|  |      */ | ||||||
|  |     public static Vector3d getEquipPointVectorOffset(List<Float> values){ | ||||||
|  |         if(values.size() > 0){ | ||||||
|  |             return new Vector3d(values.get(0),values.get(1),values.get(2)); | ||||||
|  |         } else { | ||||||
|  |             return new Vector3d(); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
| } | } | ||||||
|  | |||||||
| @ -14,7 +14,9 @@ public class EquipPoint { | |||||||
|     //the bone to attach items to for the first person viewmodel (may not be defined based on the viewmodel) |     //the bone to attach items to for the first person viewmodel (may not be defined based on the viewmodel) | ||||||
|     String firstPersonBone; |     String firstPersonBone; | ||||||
|     //the offset to apply to items that are attached to the bone |     //the offset to apply to items that are attached to the bone | ||||||
|     List<Float> offsetVector; |     List<Float> offsetVectorThirdPerson; | ||||||
|  |     //the offset to apply to items that are attached to the bone | ||||||
|  |     List<Float> offsetVectorFirstPerson; | ||||||
|     //the rotation to apply to the items that are attached to the bone |     //the rotation to apply to the items that are attached to the bone | ||||||
|     List<Float> offsetRotationThirdPerson; |     List<Float> offsetRotationThirdPerson; | ||||||
|     //the rotation to apply to the items that are attached to the view model's bone |     //the rotation to apply to the items that are attached to the view model's bone | ||||||
| @ -52,8 +54,32 @@ public class EquipPoint { | |||||||
|      * Gets the offset to apply to items that are attached to the bone |      * Gets the offset to apply to items that are attached to the bone | ||||||
|      * @return the offset |      * @return the offset | ||||||
|      */ |      */ | ||||||
|     public List<Float> getOffsetVector(){ |     public List<Float> getOffsetVectorThirdPerson(){ | ||||||
|         return offsetVector; |         return offsetVectorThirdPerson; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Sets the third person offset vector values | ||||||
|  |      * @param offsetVector The offset vector | ||||||
|  |      */ | ||||||
|  |     public void setOffsetVectorThirdPerson(List<Float> offsetVector){ | ||||||
|  |         this.offsetVectorThirdPerson = offsetVector; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Gets the offset to apply to items that are attached to the bone | ||||||
|  |      * @return the offset | ||||||
|  |      */ | ||||||
|  |     public List<Float> getOffsetVectorFirstPerson(){ | ||||||
|  |         return offsetVectorFirstPerson; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Sets the first person offset vector values | ||||||
|  |      * @param offsetVector The offset vector | ||||||
|  |      */ | ||||||
|  |     public void setOffsetVectorFirstPerson(List<Float> offsetVector){ | ||||||
|  |         this.offsetVectorFirstPerson = offsetVector; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|  | |||||||
| @ -5,6 +5,7 @@ import java.util.List; | |||||||
| import java.util.PriorityQueue; | import java.util.PriorityQueue; | ||||||
| 
 | 
 | ||||||
| import org.joml.Quaterniond; | import org.joml.Quaterniond; | ||||||
|  | import org.joml.Vector3d; | ||||||
| 
 | 
 | ||||||
| import electrosphere.engine.Globals; | import electrosphere.engine.Globals; | ||||||
| import electrosphere.entity.Entity; | import electrosphere.entity.Entity; | ||||||
| @ -237,6 +238,16 @@ public class ImGuiEntityMacros { | |||||||
|     private static float[] rotationValuesThirdPerson = new float[]{ |     private static float[] rotationValuesThirdPerson = new float[]{ | ||||||
|         0,0,0 |         0,0,0 | ||||||
|     }; |     }; | ||||||
|  |     private static float[] vectorValuesFirstPerson = new float[]{ | ||||||
|  |         0,0,0 | ||||||
|  |     }; | ||||||
|  |     private static float[] vectorValuesThirdPerson = new float[]{ | ||||||
|  |         0,0,0 | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     //constraints for vector offset | ||||||
|  |     private static final float MAXIMUM_OFFSET = 1; | ||||||
|  |     private static final float MINIMUM_OFFSET = -MAXIMUM_OFFSET; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Client scene equip state view |      * Client scene equip state view | ||||||
| @ -252,6 +263,36 @@ public class ImGuiEntityMacros { | |||||||
|                             ImGui.text("Has item equipped: " + (clientEquipState.getEquippedItemAtPoint(point.getEquipPointId()) != null)); |                             ImGui.text("Has item equipped: " + (clientEquipState.getEquippedItemAtPoint(point.getEquipPointId()) != null)); | ||||||
|                             ImGui.text("Bone (Third Person): " + point.getBone()); |                             ImGui.text("Bone (Third Person): " + point.getBone()); | ||||||
|                             ImGui.text("Bone (First Person): " + point.getFirstPersonBone()); |                             ImGui.text("Bone (First Person): " + point.getFirstPersonBone()); | ||||||
|  | 
 | ||||||
|  |                             //offsets | ||||||
|  |                             ImGui.text("[Third Person] Offset: " + AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationThirdPerson())); | ||||||
|  |                             if(ImGui.sliderFloat3("[Third Person] Offset", vectorValuesThirdPerson, MINIMUM_OFFSET, MAXIMUM_OFFSET)){ | ||||||
|  |                                 Vector3d offset = new Vector3d(vectorValuesThirdPerson[0],vectorValuesThirdPerson[1],vectorValuesThirdPerson[2]); | ||||||
|  |                                 List<Float> newValues = new LinkedList<Float>(); | ||||||
|  |                                 newValues.add((float)offset.x); | ||||||
|  |                                 newValues.add((float)offset.y); | ||||||
|  |                                 newValues.add((float)offset.z); | ||||||
|  |                                 point.setOffsetVectorThirdPerson(newValues); | ||||||
|  |                                 Entity equippedEntity = clientEquipState.getEquippedItemAtPoint(point.getEquipPointId()); | ||||||
|  |                                 if(equippedEntity != null){ | ||||||
|  |                                     AttachUtils.setVectorOffset(equippedEntity, AttachUtils.getEquipPointVectorOffset(point.getOffsetVectorThirdPerson())); | ||||||
|  |                                 } | ||||||
|  |                             } | ||||||
|  |                             ImGui.text("[First Person] Offset: " + AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationFirstPerson())); | ||||||
|  |                             if(ImGui.sliderFloat3("[First Person] Offset", vectorValuesFirstPerson, MINIMUM_OFFSET, MAXIMUM_OFFSET)){ | ||||||
|  |                                 Vector3d offset = new Vector3d(vectorValuesFirstPerson[0],vectorValuesFirstPerson[1],vectorValuesFirstPerson[2]); | ||||||
|  |                                 List<Float> newValues = new LinkedList<Float>(); | ||||||
|  |                                 newValues.add((float)offset.x); | ||||||
|  |                                 newValues.add((float)offset.y); | ||||||
|  |                                 newValues.add((float)offset.z); | ||||||
|  |                                 point.setOffsetVectorFirstPerson(newValues); | ||||||
|  |                                 Entity equippedEntity = clientEquipState.getEquippedItemAtPoint(point.getEquipPointId()); | ||||||
|  |                                 if(equippedEntity != null){ | ||||||
|  |                                     AttachUtils.setVectorOffset(equippedEntity, AttachUtils.getEquipPointVectorOffset(point.getOffsetVectorFirstPerson())); | ||||||
|  |                                 } | ||||||
|  |                             } | ||||||
|  | 
 | ||||||
|  |                             //rotations | ||||||
|                             ImGui.text("[Third Person] Rotation: " + AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationThirdPerson())); |                             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))){ |                             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]); |                                 Quaterniond rotation = new Quaterniond().rotateXYZ(rotationValuesThirdPerson[0], rotationValuesThirdPerson[1], rotationValuesThirdPerson[2]); | ||||||
|  | |||||||
| @ -117,7 +117,13 @@ public class EntityProtocol { | |||||||
|                 Entity parent = Globals.clientSceneWrapper.getEntityFromServerId(message.gettargetID()); |                 Entity parent = Globals.clientSceneWrapper.getEntityFromServerId(message.gettargetID()); | ||||||
|                 LoggerInterface.loggerNetworking.DEBUG("Attach " + message.getentityID() + " to " + message.gettargetID() + " on bone " + message.getbone()); |                 LoggerInterface.loggerNetworking.DEBUG("Attach " + message.getentityID() + " to " + message.gettargetID() + " on bone " + message.getbone()); | ||||||
|                 if(child != null && parent != null){ |                 if(child != null && parent != null){ | ||||||
|                     AttachUtils.clientAttachEntityToEntityAtBone(parent, child, message.getbone(), new Quaterniond()); |                     AttachUtils.clientAttachEntityToEntityAtBone( | ||||||
|  |                         parent, | ||||||
|  |                         child, | ||||||
|  |                         message.getbone(), | ||||||
|  |                         new Vector3d(), | ||||||
|  |                         new Quaterniond() | ||||||
|  |                     ); | ||||||
|                 } |                 } | ||||||
|             } break; |             } break; | ||||||
|             case MOVEUPDATE: { |             case MOVEUPDATE: { | ||||||
|  | |||||||
| @ -287,11 +287,13 @@ public class Actor { | |||||||
|                 rVal.y = (float)result.y; |                 rVal.y = (float)result.y; | ||||||
|                 rVal.z = (float)result.z; |                 rVal.z = (float)result.z; | ||||||
|             } else { |             } else { | ||||||
|                 throw new IllegalArgumentException("Trying to get rotation of bone that does not exist on model!"); |                 String message = "Trying to get position of bone that does not exist on model!\n" + | ||||||
|  |                 "boneName: " + boneName; | ||||||
|  |                 throw new IllegalArgumentException(message); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         if(!Double.isFinite(rVal.x)){ |         if(!Double.isFinite(rVal.x)){ | ||||||
|             throw new IllegalStateException("Bone rotation that is not finite!"); |             throw new IllegalStateException("Bone position that is not finite!"); | ||||||
|         } |         } | ||||||
|         return rVal; |         return rVal; | ||||||
|     } |     } | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user