servergroundmovementtree collidable 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
b2e93da04e
commit
6723031154
@ -2098,6 +2098,7 @@ TownLayout test
|
||||
Macro pathing test
|
||||
Actually fix pathing spinlock
|
||||
Support for observing ai entities
|
||||
ServerGroundMovementTree supports collidable entities
|
||||
|
||||
|
||||
|
||||
|
||||
@ -14,6 +14,7 @@ import electrosphere.entity.types.creature.CreatureUtils;
|
||||
import electrosphere.entity.Entity;
|
||||
import electrosphere.entity.EntityDataStrings;
|
||||
import electrosphere.entity.EntityUtils;
|
||||
import electrosphere.entity.ServerEntityUtils;
|
||||
import electrosphere.entity.btree.BehaviorTree;
|
||||
import electrosphere.entity.state.AnimationPriorities;
|
||||
import electrosphere.entity.state.attack.ServerAttackTree;
|
||||
@ -182,10 +183,10 @@ public class ServerGroundMovementTree implements BehaviorTree {
|
||||
}
|
||||
DBody body = PhysicsEntityUtils.getDBody(parent);
|
||||
//TODO: eventually handle non-rigid-body entities
|
||||
if(body == null){
|
||||
return;
|
||||
DVector3C linearVelocity = null;
|
||||
if(body != null){
|
||||
linearVelocity = body.getLinearVel();
|
||||
}
|
||||
DVector3C linearVelocity = body.getLinearVel();
|
||||
|
||||
//
|
||||
//rotation update
|
||||
@ -288,14 +289,17 @@ public class ServerGroundMovementTree implements BehaviorTree {
|
||||
state = MovementTreeState.MOVE;
|
||||
CreatureUtils.setVelocity(parent, velocity);
|
||||
}
|
||||
PhysicsEntityUtils.getDBody(parent).enable();
|
||||
PhysicsEntityUtils.getDBody(parent).setLinearVel(
|
||||
movementVector.x * velocity * Globals.engineState.timekeeper.getSimFrameTime(),
|
||||
linearVelocity.get1(),
|
||||
movementVector.z * velocity * Globals.engineState.timekeeper.getSimFrameTime()
|
||||
);
|
||||
body.setAngularVel(0, 0, 0);
|
||||
// position.set(newPosition);
|
||||
if(body == null){
|
||||
ServerEntityUtils.repositionEntity(parent, new Vector3d(position).add(velocity,velocity,velocity));
|
||||
} else {
|
||||
body.enable();
|
||||
body.setLinearVel(
|
||||
movementVector.x * velocity * Globals.engineState.timekeeper.getSimFrameTime(),
|
||||
linearVelocity.get1(),
|
||||
movementVector.z * velocity * Globals.engineState.timekeeper.getSimFrameTime()
|
||||
);
|
||||
body.setAngularVel(0, 0, 0);
|
||||
}
|
||||
|
||||
GravityUtils.serverAttemptActivateGravity(parent);
|
||||
|
||||
@ -334,13 +338,17 @@ public class ServerGroundMovementTree implements BehaviorTree {
|
||||
}
|
||||
this.updateVelocity();
|
||||
float velocity = this.getModifiedVelocity();
|
||||
PhysicsEntityUtils.getDBody(parent).enable();
|
||||
PhysicsEntityUtils.getDBody(parent).setLinearVel(
|
||||
movementVector.x * velocity * Globals.engineState.timekeeper.getSimFrameTime(),
|
||||
linearVelocity.get1(),
|
||||
movementVector.z * velocity * Globals.engineState.timekeeper.getSimFrameTime()
|
||||
);
|
||||
body.setAngularVel(0, 0, 0);
|
||||
if(body == null){
|
||||
ServerEntityUtils.repositionEntity(parent, new Vector3d(position).add(velocity,velocity,velocity));
|
||||
} else {
|
||||
body.enable();
|
||||
body.setLinearVel(
|
||||
movementVector.x * velocity * Globals.engineState.timekeeper.getSimFrameTime(),
|
||||
linearVelocity.get1(),
|
||||
movementVector.z * velocity * Globals.engineState.timekeeper.getSimFrameTime()
|
||||
);
|
||||
body.setAngularVel(0, 0, 0);
|
||||
}
|
||||
|
||||
GravityUtils.serverAttemptActivateGravity(parent);
|
||||
|
||||
@ -398,19 +406,17 @@ public class ServerGroundMovementTree implements BehaviorTree {
|
||||
} else {
|
||||
GravityUtils.serverAttemptActivateGravity(parent);
|
||||
}
|
||||
// PhysicsEntityUtils.getDBody(parent).addForce(
|
||||
// movementVector.x * velocity * Globals.timekeeper.getSimFrameTime(),
|
||||
// linearVelocity.get1(),
|
||||
// movementVector.z * velocity * Globals.timekeeper.getSimFrameTime()
|
||||
// );
|
||||
PhysicsEntityUtils.getDBody(parent).enable();
|
||||
PhysicsEntityUtils.getDBody(parent).setLinearVel(
|
||||
movementVector.x * velocity * Globals.engineState.timekeeper.getSimFrameTime(),
|
||||
linearVelocity.get1(),
|
||||
movementVector.z * velocity * Globals.engineState.timekeeper.getSimFrameTime()
|
||||
);
|
||||
body.setAngularVel(0, 0, 0);
|
||||
// position.set(newPosition);
|
||||
if(body == null){
|
||||
ServerEntityUtils.repositionEntity(parent, new Vector3d(position).add(velocity,velocity,velocity));
|
||||
} else {
|
||||
body.enable();
|
||||
body.setLinearVel(
|
||||
movementVector.x * velocity * Globals.engineState.timekeeper.getSimFrameTime(),
|
||||
linearVelocity.get1(),
|
||||
movementVector.z * velocity * Globals.engineState.timekeeper.getSimFrameTime()
|
||||
);
|
||||
body.setAngularVel(0, 0, 0);
|
||||
}
|
||||
|
||||
DataCellSearchUtils.getEntityDataCell(parent).broadcastNetworkMessage(
|
||||
EntityMessage.constructmoveUpdateMessage(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user