devtools
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2024-07-24 13:57:16 -04:00
parent 58c5ac0512
commit 56ed405aea
7 changed files with 62 additions and 22 deletions

View File

@ -256,7 +256,8 @@
"bone" : "Hand.R", "bone" : "Hand.R",
"firstPersonBone" : "hand.R", "firstPersonBone" : "hand.R",
"offsetVector" : [0,0,0], "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, "canBlock" : true,
"equipClassWhitelist" : [ "equipClassWhitelist" : [
"tool", "tool",

View File

@ -450,6 +450,7 @@ Attacker ai tree
(07/24/2024) (07/24/2024)
2 Hand katana 2 Hand katana
Switching between first and third person Switching between first and third person
Devtools for updating first person attachment rotations
# TODO # TODO

View File

@ -131,7 +131,7 @@ 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.getOffsetRotation())); AttachUtils.clientAttachEntityToEntityAtBone(parent, toEquip, point.getBone(), AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationThirdPerson()));
//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);
@ -148,9 +148,9 @@ public class ClientEquipState implements BehaviorTree {
//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(Globals.controlHandler.cameraIsThirdPerson()){
AttachUtils.clientAttachEntityToEntityAtBone(parent, toEquip, point.getBone(), AttachUtils.getEquipPointRotationOffset(point.getOffsetRotation())); AttachUtils.clientAttachEntityToEntityAtBone(parent, toEquip, point.getBone(), AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationThirdPerson()));
} else { } 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)){ 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);
@ -341,14 +341,14 @@ public class ClientEquipState implements BehaviorTree {
EquipPoint point = this.getEquipPoint(occupiedPoint); EquipPoint point = this.getEquipPoint(occupiedPoint);
Entity toEquip = this.equipMap.get(point.getEquipPointId()); Entity toEquip = this.equipMap.get(point.getEquipPointId());
AttachUtils.clientDetatchEntityFromEntityAtBone(Globals.firstPersonEntity, toEquip); 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 { } else {
for(String occupiedPoint : this.getEquippedPoints()){ for(String occupiedPoint : this.getEquippedPoints()){
EquipPoint point = this.getEquipPoint(occupiedPoint); EquipPoint point = this.getEquipPoint(occupiedPoint);
Entity toEquip = this.equipMap.get(point.getEquipPointId()); Entity toEquip = this.equipMap.get(point.getEquipPointId());
AttachUtils.clientDetatchEntityFromEntityAtBone(Globals.playerEntity, toEquip); 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()));
} }
} }
} }

View File

@ -114,7 +114,7 @@ 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.getOffsetRotation())); AttachUtils.serverAttachEntityToEntityAtBone(parent, inWorldItem, point.getBone(), 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);
@ -131,7 +131,7 @@ 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.getOffsetRotation())); AttachUtils.serverAttachEntityToEntityAtBone(parent, inWorldItem, point.getBone(), 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);

View File

@ -572,8 +572,9 @@ public class AttachUtils {
* @param parentEntity * @param parentEntity
* @return The list of entities that are attached to this parent entity, or null if undefined * @return The list of entities that are attached to this parent entity, or null if undefined
*/ */
public static LinkedList<Entity> getChildrenList(Entity parentEntity){ @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
return (LinkedList<Entity>)parentEntity.getData(EntityDataStrings.ATTACH_CHILDREN_LIST); public static List<Entity> getChildrenList(Entity parentEntity){
return (List<Entity>)parentEntity.getData(EntityDataStrings.ATTACH_CHILDREN_LIST);
} }
/** /**

View File

@ -16,7 +16,9 @@ public class EquipPoint {
//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> offsetVector;
//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> 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 //signals that this equip point can block
boolean canBlock; boolean canBlock;
//the equip classes that are whitelisted for this equip point //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 * @return the rotation
*/ */
public List<Float> getOffsetRotation(){ public List<Float> getOffsetRotationThirdPerson(){
return offsetRotation; return offsetRotationThirdPerson;
} }
/** /**
* Sets the offset rotation (used primarily for debug and engine testing) * Sets the offset rotation (used primarily for debug and engine testing)
* @param offsetRotation The new offset rotation * @param offsetRotation The new offset rotation
*/ */
public void setOffsetRotation(List<Float> offsetRotation){ public void setOffsetRotationThirdPerson(List<Float> offsetRotation){
this.offsetRotation = 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;
} }
/** /**

View File

@ -161,7 +161,10 @@ public class ImGuiEntityMacros {
equipStateView.setCallback(new ImGuiWindowCallback() { equipStateView.setCallback(new ImGuiWindowCallback() {
//stores the edited rotation values //stores the edited rotation values
float[] rotationValues = new float[]{ float[] rotationValuesFirstPerson = new float[]{
0,0,0
};
float[] rotationValuesThirdPerson = new float[]{
0,0,0 0,0,0
}; };
@ -176,18 +179,32 @@ 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());
ImGui.text("Rotation: " + AttachUtils.getEquipPointRotationOffset(point.getOffsetRotation())); ImGui.text("[Third Person] Rotation: " + AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationThirdPerson()));
if(ImGui.sliderFloat3("Rotation (In Euler along x,y,z)", rotationValues, 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(rotationValues[0], rotationValues[1], rotationValues[2]); Quaterniond rotation = new Quaterniond().rotateXYZ(rotationValuesThirdPerson[0], rotationValuesThirdPerson[1], rotationValuesThirdPerson[2]);
List<Float> newValues = new LinkedList<Float>(); List<Float> newValues = new LinkedList<Float>();
newValues.add((float)rotation.x); newValues.add((float)rotation.x);
newValues.add((float)rotation.y); newValues.add((float)rotation.y);
newValues.add((float)rotation.z); newValues.add((float)rotation.z);
newValues.add((float)rotation.w); newValues.add((float)rotation.w);
point.setOffsetRotation(newValues); point.setOffsetRotationThirdPerson(newValues);
Entity equippedEntity = clientEquipState.getEquippedItemAtPoint(point.getEquipPointId()); Entity equippedEntity = clientEquipState.getEquippedItemAtPoint(point.getEquipPointId());
if(equippedEntity != null){ 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()));
} }
} }
} }