small movement work
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
This commit is contained in:
parent
859670d3b6
commit
cacc8dc57f
@ -129,6 +129,8 @@
|
||||
"type" : "GROUND",
|
||||
"acceleration" : 5000.0,
|
||||
"maxVelocity" : 500.5,
|
||||
"strafeMultiplier" : 0.7,
|
||||
"backpedalMultiplier" : 0.5,
|
||||
"animationStartup" : {
|
||||
"nameThirdPerson" : "Jog",
|
||||
"priorityCategory" : "CORE_MOVEMENT"
|
||||
|
||||
@ -503,6 +503,11 @@ State transition utils interrupt support
|
||||
Block animation cancels immediately on first person model
|
||||
Bone-attachment fix
|
||||
Fix data for viewmodel hand.r equip point
|
||||
Support audio on state transition
|
||||
Audio on block state transitions
|
||||
|
||||
(08/04/2024)
|
||||
Strafe/backpedal movement speed multipliers
|
||||
|
||||
# TODO
|
||||
|
||||
|
||||
@ -135,7 +135,7 @@ public class Globals {
|
||||
public static boolean RUN_DEMO = false;
|
||||
public static boolean RUN_CLIENT = true;
|
||||
public static boolean RUN_HIDDEN = false; //glfw session will be created with hidden window
|
||||
public static boolean RUN_AUDIO = true;
|
||||
public static boolean RUN_AUDIO = false;
|
||||
public static int clientCharacterID;
|
||||
|
||||
//
|
||||
|
||||
@ -20,7 +20,6 @@ import electrosphere.entity.state.attack.ClientAttackTree.AttackTreeState;
|
||||
import electrosphere.entity.state.client.firstPerson.FirstPersonTree;
|
||||
import electrosphere.entity.state.movement.FallTree;
|
||||
import electrosphere.entity.state.movement.SprintTree;
|
||||
import electrosphere.entity.state.movement.SprintTree.SprintTreeState;
|
||||
import electrosphere.entity.state.movement.jump.ClientJumpTree;
|
||||
import electrosphere.net.parser.net.message.EntityMessage;
|
||||
import electrosphere.net.synchronization.annotation.SyncedField;
|
||||
@ -93,7 +92,7 @@ public class ClientGroundMovementTree implements BehaviorTree {
|
||||
GroundMovementSystem groundMovementData;
|
||||
|
||||
Entity parent;
|
||||
|
||||
|
||||
Collidable collidable;
|
||||
|
||||
CopyOnWriteArrayList<EntityMessage> networkMessageQueue = new CopyOnWriteArrayList<EntityMessage>();
|
||||
@ -112,6 +111,9 @@ public class ClientGroundMovementTree implements BehaviorTree {
|
||||
*/
|
||||
private ClientGroundMovementTree(Entity e, Object ... params){
|
||||
//Collidable collidable, GroundMovementSystem groundMovementData
|
||||
if(params.length < 2){
|
||||
throw new IllegalArgumentException("Tried to create a client ground movement tree without providing both mandatory parameters");
|
||||
}
|
||||
state = MovementTreeState.IDLE;
|
||||
parent = e;
|
||||
this.collidable = (Collidable)params[0];
|
||||
@ -188,9 +190,8 @@ public class ClientGroundMovementTree implements BehaviorTree {
|
||||
public void simulate(float deltaTime){
|
||||
float velocity = CreatureUtils.getVelocity(parent);
|
||||
float acceleration = CreatureUtils.getAcceleration(parent);
|
||||
float maxNaturalVelocity = sprintTree != null && sprintTree.getState() == SprintTreeState.SPRINTING ? sprintTree.getMaxVelocity() : CreatureUtils.getMaxNaturalVelocity(parent);
|
||||
float maxNaturalVelocity = ServerGroundMovementTree.getMaximumVelocity(parent, this.groundMovementData, facing);
|
||||
Actor entityActor = EntityUtils.getActor(parent);
|
||||
// Model entityModel = Globals.assetManager.fetchModel(EntityUtils.getEntityModelPath(parent));
|
||||
Vector3d position = EntityUtils.getPosition(parent);
|
||||
Vector3d facingVector = CreatureUtils.getFacingVector(parent);
|
||||
DBody body = PhysicsEntityUtils.getDBody(parent);
|
||||
|
||||
@ -14,6 +14,7 @@ import electrosphere.collision.collidable.Collidable;
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.entity.types.camera.CameraEntityUtils;
|
||||
import electrosphere.entity.types.creature.CreatureUtils;
|
||||
import electrosphere.game.data.creature.type.movement.GroundMovementSystem;
|
||||
import electrosphere.entity.Entity;
|
||||
import electrosphere.entity.EntityDataStrings;
|
||||
import electrosphere.entity.EntityUtils;
|
||||
@ -23,7 +24,6 @@ import electrosphere.entity.state.attack.ClientAttackTree.AttackTreeState;
|
||||
import electrosphere.entity.state.attack.ServerAttackTree;
|
||||
import electrosphere.entity.state.movement.ServerFallTree;
|
||||
import electrosphere.entity.state.movement.ServerSprintTree;
|
||||
import electrosphere.entity.state.movement.ServerSprintTree.SprintTreeState;
|
||||
import electrosphere.entity.state.movement.groundmove.ClientGroundMovementTree.MovementRelativeFacing;
|
||||
import electrosphere.entity.state.movement.groundmove.ClientGroundMovementTree.MovementTreeState;
|
||||
import electrosphere.entity.state.movement.jump.ServerJumpTree;
|
||||
@ -62,6 +62,9 @@ public class ServerGroundMovementTree implements BehaviorTree {
|
||||
MovementTreeState state;
|
||||
@SyncedField
|
||||
MovementRelativeFacing facing;
|
||||
|
||||
//The data for the movement system
|
||||
GroundMovementSystem groundMovementSystem;
|
||||
|
||||
ServerSprintTree sprintTree;
|
||||
ServerJumpTree jumpTree;
|
||||
@ -80,11 +83,12 @@ public class ServerGroundMovementTree implements BehaviorTree {
|
||||
|
||||
|
||||
private ServerGroundMovementTree(Entity e, Object ... params){
|
||||
//Collidable collidable
|
||||
//Collidable collidable, GroundMovementSystem system
|
||||
state = MovementTreeState.IDLE;
|
||||
facing = MovementRelativeFacing.FORWARD;
|
||||
parent = e;
|
||||
this.collidable = (Collidable)params[0];
|
||||
this.groundMovementSystem = (GroundMovementSystem)params[1];
|
||||
}
|
||||
|
||||
public MovementTreeState getState(){
|
||||
@ -165,7 +169,7 @@ public class ServerGroundMovementTree implements BehaviorTree {
|
||||
if(CreatureUtils.hasVelocity(parent)){
|
||||
velocity = CreatureUtils.getVelocity(parent);
|
||||
acceleration = CreatureUtils.getAcceleration(parent);
|
||||
maxNaturalVelocity = sprintTree != null && sprintTree.getState() == SprintTreeState.SPRINTING ? sprintTree.getMaxVelocity() : CreatureUtils.getMaxNaturalVelocity(parent);
|
||||
maxNaturalVelocity = ServerGroundMovementTree.getMaximumVelocity(parent, this.groundMovementSystem, facing);
|
||||
}
|
||||
if(ServerPlayerViewDirTree.hasTree(parent)){
|
||||
ServerPlayerViewDirTree serverViewTree =ServerPlayerViewDirTree.getTree(parent);
|
||||
@ -471,6 +475,37 @@ public class ServerGroundMovementTree implements BehaviorTree {
|
||||
this.fallTree = fallTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the maximum velocity of an entity
|
||||
* @param entity
|
||||
* @param groundMovementSystem
|
||||
* @return
|
||||
*/
|
||||
public static float getMaximumVelocity(Entity entity, GroundMovementSystem groundMovementSystem, MovementRelativeFacing facing){
|
||||
float maxVelocity = groundMovementSystem.getMaxVelocity();
|
||||
switch(facing){
|
||||
case FORWARD: {
|
||||
return maxVelocity;
|
||||
}
|
||||
case BACKWARD_LEFT:
|
||||
case BACKWARD_RIGHT:
|
||||
case BACKWARD: {
|
||||
if(groundMovementSystem.getBackpedalMultiplier() != null){
|
||||
return maxVelocity * groundMovementSystem.getBackpedalMultiplier();
|
||||
}
|
||||
} break;
|
||||
case LEFT:
|
||||
case RIGHT:
|
||||
case FORWARD_LEFT:
|
||||
case FORWARD_RIGHT: {
|
||||
if(groundMovementSystem.getStrafeMultiplier() != null){
|
||||
return maxVelocity * groundMovementSystem.getStrafeMultiplier();
|
||||
}
|
||||
} break;
|
||||
}
|
||||
return maxVelocity;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p> Automatically generated </p>
|
||||
* <p>
|
||||
|
||||
@ -399,7 +399,7 @@ public class CreatureUtils {
|
||||
// Generic ground
|
||||
case GroundMovementSystem.GROUND_MOVEMENT_SYSTEM:
|
||||
GroundMovementSystem groundMovementSystem = (GroundMovementSystem)movementSystem;
|
||||
ServerGroundMovementTree moveTree = ServerGroundMovementTree.attachTree(rVal,CollisionObjUtils.getCollidable(rVal));
|
||||
ServerGroundMovementTree moveTree = ServerGroundMovementTree.attachTree(rVal,CollisionObjUtils.getCollidable(rVal),groundMovementSystem);
|
||||
if(groundMovementSystem.getAnimationStartup() != null){
|
||||
moveTree.setAnimationStartUp(groundMovementSystem.getAnimationStartup().getNameThirdPerson());
|
||||
}
|
||||
|
||||
@ -18,6 +18,12 @@ public class GroundMovementSystem implements MovementSystem {
|
||||
float acceleration;
|
||||
float maxVelocity;
|
||||
|
||||
//The multiplier for movement speed when strafing
|
||||
Float strafeMultiplier;
|
||||
|
||||
//The multiplier for movement speed when backpedaling
|
||||
Float backpedalMultiplier;
|
||||
|
||||
//startup data
|
||||
TreeDataAnimation animationStartup;
|
||||
|
||||
@ -79,6 +85,22 @@ public class GroundMovementSystem implements MovementSystem {
|
||||
return sprintSystem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the multiplier applied to the movement speed while the creature is strafing
|
||||
* @return The multiplier
|
||||
*/
|
||||
public Float getStrafeMultiplier(){
|
||||
return this.strafeMultiplier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the multiplier applied to the movement speed while the creature is backpedaling
|
||||
* @return The multiplier
|
||||
*/
|
||||
public Float getBackpedalMultiplier(){
|
||||
return this.backpedalMultiplier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return type;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user