properly delete entities on the server
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
b36168bb14
commit
b0277f9f74
@ -16,7 +16,6 @@
|
|||||||
Stability
|
Stability
|
||||||
Movement penalty while swinging weapon
|
Movement penalty while swinging weapon
|
||||||
Transition animation for blocking with two hands
|
Transition animation for blocking with two hands
|
||||||
Strafing walking animation
|
|
||||||
|
|
||||||
+ bug fixes
|
+ bug fixes
|
||||||
Fix grass rendering distance
|
Fix grass rendering distance
|
||||||
|
|||||||
@ -597,6 +597,8 @@ Fix hitbox placement does not scale with entity scale on server
|
|||||||
|
|
||||||
Fix not all grass tiles update when updating a nearby voxel (ie it doesn't go into negative coordinates to scan for foliage updates)
|
Fix not all grass tiles update when updating a nearby voxel (ie it doesn't go into negative coordinates to scan for foliage updates)
|
||||||
|
|
||||||
|
Fix typescript load error
|
||||||
|
|
||||||
Refactor menu clases under electrosphere.client package
|
Refactor menu clases under electrosphere.client package
|
||||||
|
|
||||||
Allow texture map to bind multiple model paths to a single set of mesh->textures
|
Allow texture map to bind multiple model paths to a single set of mesh->textures
|
||||||
|
|||||||
@ -84,7 +84,7 @@ public class FluidCell {
|
|||||||
*/
|
*/
|
||||||
public void destroy(){
|
public void destroy(){
|
||||||
CollisionEngine collisionEngine = Globals.clientSceneWrapper.getCollisionEngine();
|
CollisionEngine collisionEngine = Globals.clientSceneWrapper.getCollisionEngine();
|
||||||
collisionEngine.destroyEntityThatHasPhysics(modelEntity);
|
collisionEngine.destroyPhysics(modelEntity);
|
||||||
EntityUtils.cleanUpEntity(modelEntity);
|
EntityUtils.cleanUpEntity(modelEntity);
|
||||||
//destruct model
|
//destruct model
|
||||||
String modelPath = (String)modelEntity.getData(EntityDataStrings.DATA_STRING_MODEL_PATH);
|
String modelPath = (String)modelEntity.getData(EntityDataStrings.DATA_STRING_MODEL_PATH);
|
||||||
|
|||||||
@ -101,7 +101,7 @@ public class DrawCell {
|
|||||||
*/
|
*/
|
||||||
public void destroy(){
|
public void destroy(){
|
||||||
CollisionEngine collisionEngine = Globals.clientSceneWrapper.getCollisionEngine();
|
CollisionEngine collisionEngine = Globals.clientSceneWrapper.getCollisionEngine();
|
||||||
collisionEngine.destroyEntityThatHasPhysics(modelEntity);
|
collisionEngine.destroyPhysics(modelEntity);
|
||||||
EntityUtils.cleanUpEntity(modelEntity);
|
EntityUtils.cleanUpEntity(modelEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -51,6 +51,7 @@ import electrosphere.entity.Entity;
|
|||||||
import electrosphere.entity.EntityDataStrings;
|
import electrosphere.entity.EntityDataStrings;
|
||||||
import electrosphere.entity.EntityUtils;
|
import electrosphere.entity.EntityUtils;
|
||||||
import electrosphere.entity.state.collidable.Impulse;
|
import electrosphere.entity.state.collidable.Impulse;
|
||||||
|
import electrosphere.entity.state.physicssync.ServerPhysicsSyncTree;
|
||||||
import electrosphere.game.data.collidable.CollidableTemplate;
|
import electrosphere.game.data.collidable.CollidableTemplate;
|
||||||
import electrosphere.game.data.collidable.HitboxData;
|
import electrosphere.game.data.collidable.HitboxData;
|
||||||
import electrosphere.logger.LoggerInterface;
|
import electrosphere.logger.LoggerInterface;
|
||||||
@ -479,6 +480,17 @@ public class CollisionEngine {
|
|||||||
spaceLock.release();
|
spaceLock.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deregisters a collidable from the physics engine
|
||||||
|
* @param collidable The collidable
|
||||||
|
*/
|
||||||
|
public void deregisterCollisionObject(DBody body, Collidable collidable){
|
||||||
|
spaceLock.acquireUninterruptibly();
|
||||||
|
bodyPointerMap.remove(body);
|
||||||
|
collidableList.remove(collidable);
|
||||||
|
spaceLock.release();
|
||||||
|
}
|
||||||
|
|
||||||
public void listBodyPositions(){
|
public void listBodyPositions(){
|
||||||
for(DBody body : bodies){
|
for(DBody body : bodies){
|
||||||
LoggerInterface.loggerEngine.INFO("" + body);
|
LoggerInterface.loggerEngine.INFO("" + body);
|
||||||
@ -581,7 +593,7 @@ public class CollisionEngine {
|
|||||||
* Destroys a body and all geometry under the body
|
* Destroys a body and all geometry under the body
|
||||||
* @param body The DBody to destroy
|
* @param body The DBody to destroy
|
||||||
*/
|
*/
|
||||||
public void deregisterPhysicsObject(DBody body){
|
private void deregisterPhysicsObject(DBody body){
|
||||||
spaceLock.acquireUninterruptibly();
|
spaceLock.acquireUninterruptibly();
|
||||||
if(bodies.contains(body)){
|
if(bodies.contains(body)){
|
||||||
bodies.remove(body);
|
bodies.remove(body);
|
||||||
@ -596,12 +608,21 @@ public class CollisionEngine {
|
|||||||
spaceLock.release();
|
spaceLock.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void destroyEntityThatHasPhysics(Entity e){
|
/**
|
||||||
|
* Destroys the physics on an entity
|
||||||
|
* @param e The entity
|
||||||
|
*/
|
||||||
|
public void destroyPhysics(Entity e){
|
||||||
//make uncollidable
|
//make uncollidable
|
||||||
if(e.containsKey(EntityDataStrings.PHYSICS_COLLISION_BODY)){
|
if(e.containsKey(EntityDataStrings.PHYSICS_COLLISION_BODY)){
|
||||||
DBody rigidBody = (DBody)e.getData(EntityDataStrings.PHYSICS_COLLISION_BODY);
|
DBody rigidBody = (DBody)e.getData(EntityDataStrings.PHYSICS_COLLISION_BODY);
|
||||||
|
deregisterCollisionObject(rigidBody,PhysicsEntityUtils.getCollidable(e));
|
||||||
|
e.removeData(EntityDataStrings.PHYSICS_COLLISION_BODY);
|
||||||
deregisterPhysicsObject(rigidBody);
|
deregisterPhysicsObject(rigidBody);
|
||||||
}
|
}
|
||||||
|
if(ServerPhysicsSyncTree.hasTree(e)){
|
||||||
|
ServerPhysicsSyncTree.detachTree(e, ServerPhysicsSyncTree.getTree(e));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -312,4 +312,13 @@ public class PhysicsEntityUtils {
|
|||||||
collisionEngine.setGeomTransform(geom, position, rotation);
|
collisionEngine.setGeomTransform(geom, position, rotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the collidable attached to the entity
|
||||||
|
* @param entity The entity
|
||||||
|
* @return The collidable if it exists, null otherwise
|
||||||
|
*/
|
||||||
|
public static Collidable getCollidable(Entity entity){
|
||||||
|
return (Collidable)entity.getData(EntityDataStrings.PHYSICS_COLLIDABLE);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -134,7 +134,9 @@ public class Scene {
|
|||||||
* @param tree The behavior tree to deregister
|
* @param tree The behavior tree to deregister
|
||||||
*/
|
*/
|
||||||
public void deregisterBehaviorTree(BehaviorTree tree){
|
public void deregisterBehaviorTree(BehaviorTree tree){
|
||||||
behaviorTreeList.remove(tree);
|
while(behaviorTreeList.contains(tree)){
|
||||||
|
behaviorTreeList.remove(tree);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,9 +1,12 @@
|
|||||||
package electrosphere.entity;
|
package electrosphere.entity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
|
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
import electrosphere.entity.state.hitbox.HitboxCollectionState;
|
import electrosphere.entity.state.hitbox.HitboxCollectionState;
|
||||||
|
import electrosphere.entity.types.attach.AttachUtils;
|
||||||
import electrosphere.entity.types.collision.CollisionObjUtils;
|
import electrosphere.entity.types.collision.CollisionObjUtils;
|
||||||
import electrosphere.net.parser.net.message.EntityMessage;
|
import electrosphere.net.parser.net.message.EntityMessage;
|
||||||
import electrosphere.server.datacell.Realm;
|
import electrosphere.server.datacell.Realm;
|
||||||
@ -82,18 +85,42 @@ public class ServerEntityUtils {
|
|||||||
* @param entity the entity to destroy
|
* @param entity the entity to destroy
|
||||||
*/
|
*/
|
||||||
public static void destroyEntity(Entity entity){
|
public static void destroyEntity(Entity entity){
|
||||||
|
//
|
||||||
|
//get info required to destroy
|
||||||
ServerDataCell cell = DataCellSearchUtils.getEntityDataCell(entity);
|
ServerDataCell cell = DataCellSearchUtils.getEntityDataCell(entity);
|
||||||
Realm realm = Globals.realmManager.getEntityRealm(entity);
|
Realm realm = Globals.realmManager.getEntityRealm(entity);
|
||||||
|
|
||||||
|
//
|
||||||
|
//destroy the child entities, too
|
||||||
|
if(AttachUtils.hasChildren(entity)){
|
||||||
|
List<Entity> children = AttachUtils.getChildrenList(entity);
|
||||||
|
for(Entity child : children){
|
||||||
|
ServerEntityUtils.destroyEntity(child);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
//cell specific logic
|
||||||
if(cell != null){
|
if(cell != null){
|
||||||
cell.broadcastNetworkMessage(EntityMessage.constructDestroyMessage(entity.getId()));
|
cell.broadcastNetworkMessage(EntityMessage.constructDestroyMessage(entity.getId()));
|
||||||
|
cell.getScene().deregisterEntity(entity);
|
||||||
//if the entity had physics, remove them from the world
|
|
||||||
realm.getCollisionEngine().destroyEntityThatHasPhysics(entity);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
//realm specific logic
|
||||||
|
if(realm != null){
|
||||||
|
realm.getCollisionEngine().destroyPhysics(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
//detatch from all global tracking
|
||||||
HitboxCollectionState.destroyHitboxState(entity);
|
HitboxCollectionState.destroyHitboxState(entity);
|
||||||
ServerBehaviorTreeUtils.deregisterEntity(entity);
|
ServerBehaviorTreeUtils.deregisterEntity(entity);
|
||||||
Globals.realmManager.removeEntity(entity);
|
Globals.realmManager.removeEntity(entity);
|
||||||
EntityLookupUtils.removeEntity(entity);
|
EntityLookupUtils.removeEntity(entity);
|
||||||
|
Globals.aiManager.removeAI(entity);
|
||||||
|
|
||||||
|
//
|
||||||
//deregister all behavior trees
|
//deregister all behavior trees
|
||||||
EntityUtils.cleanUpEntity(entity);
|
EntityUtils.cleanUpEntity(entity);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,8 +6,6 @@ import java.util.LinkedList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.ode4j.ode.DBody;
|
|
||||||
|
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.EntityCreationUtils;
|
import electrosphere.entity.EntityCreationUtils;
|
||||||
@ -154,8 +152,7 @@ public class ClientEquipState implements BehaviorTree {
|
|||||||
}
|
}
|
||||||
//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);
|
Globals.clientSceneWrapper.getCollisionEngine().destroyPhysics(toEquip);
|
||||||
Globals.clientSceneWrapper.getCollisionEngine().deregisterPhysicsObject(rigidBody);
|
|
||||||
}
|
}
|
||||||
//hide toEquip actor
|
//hide toEquip actor
|
||||||
EntityUtils.setDraw(toEquip, false);
|
EntityUtils.setDraw(toEquip, false);
|
||||||
@ -194,8 +191,7 @@ public class ClientEquipState implements BehaviorTree {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
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);
|
Globals.clientSceneWrapper.getCollisionEngine().destroyPhysics(toEquip);
|
||||||
Globals.clientSceneWrapper.getCollisionEngine().deregisterPhysicsObject(rigidBody);
|
|
||||||
}
|
}
|
||||||
Globals.clientSceneWrapper.getScene().removeEntityFromTag(toEquip, EntityTags.TARGETABLE);
|
Globals.clientSceneWrapper.getScene().removeEntityFromTag(toEquip, EntityTags.TARGETABLE);
|
||||||
GravityUtils.clientAttemptDeactivateGravity(toEquip);
|
GravityUtils.clientAttemptDeactivateGravity(toEquip);
|
||||||
|
|||||||
@ -9,7 +9,6 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
import org.ode4j.ode.DBody;
|
|
||||||
|
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
@ -126,9 +125,8 @@ public class ServerEquipState implements BehaviorTree {
|
|||||||
);
|
);
|
||||||
//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);
|
|
||||||
Realm inWorldRealm = Globals.realmManager.getEntityRealm(inWorldItem);
|
Realm inWorldRealm = Globals.realmManager.getEntityRealm(inWorldItem);
|
||||||
inWorldRealm.getCollisionEngine().deregisterPhysicsObject(rigidBody);
|
inWorldRealm.getCollisionEngine().destroyPhysics(inWorldItem);
|
||||||
}
|
}
|
||||||
//hide toEquip actor
|
//hide toEquip actor
|
||||||
EntityUtils.setDraw(inWorldItem, false);
|
EntityUtils.setDraw(inWorldItem, false);
|
||||||
@ -148,9 +146,8 @@ public class ServerEquipState implements BehaviorTree {
|
|||||||
AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationThirdPerson())
|
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);
|
|
||||||
Realm inWorldRealm = Globals.realmManager.getEntityRealm(inWorldItem);
|
Realm inWorldRealm = Globals.realmManager.getEntityRealm(inWorldItem);
|
||||||
inWorldRealm.getCollisionEngine().deregisterPhysicsObject(rigidBody);
|
inWorldRealm.getCollisionEngine().destroyPhysics(inWorldItem);
|
||||||
}
|
}
|
||||||
ServerEntityTagUtils.removeTagFromEntity(inWorldItem, EntityTags.TARGETABLE);
|
ServerEntityTagUtils.removeTagFromEntity(inWorldItem, EntityTags.TARGETABLE);
|
||||||
GravityUtils.serverAttemptDeactivateGravity(inWorldItem);
|
GravityUtils.serverAttemptDeactivateGravity(inWorldItem);
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import electrosphere.entity.Entity;
|
|||||||
import electrosphere.entity.EntityDataStrings;
|
import electrosphere.entity.EntityDataStrings;
|
||||||
import electrosphere.entity.EntityUtils;
|
import electrosphere.entity.EntityUtils;
|
||||||
import electrosphere.entity.btree.BehaviorTree;
|
import electrosphere.entity.btree.BehaviorTree;
|
||||||
|
import electrosphere.logger.LoggerInterface;
|
||||||
import electrosphere.net.parser.net.message.EntityMessage;
|
import electrosphere.net.parser.net.message.EntityMessage;
|
||||||
import electrosphere.server.datacell.utils.DataCellSearchUtils;
|
import electrosphere.server.datacell.utils.DataCellSearchUtils;
|
||||||
import electrosphere.server.datacell.utils.ServerBehaviorTreeUtils;
|
import electrosphere.server.datacell.utils.ServerBehaviorTreeUtils;
|
||||||
@ -44,40 +45,44 @@ public class ServerPhysicsSyncTree implements BehaviorTree {
|
|||||||
Vector3d position = EntityUtils.getPosition(parent);
|
Vector3d position = EntityUtils.getPosition(parent);
|
||||||
Quaterniond rotation = EntityUtils.getRotation(parent);
|
Quaterniond rotation = EntityUtils.getRotation(parent);
|
||||||
DBody body = PhysicsEntityUtils.getDBody(parent);
|
DBody body = PhysicsEntityUtils.getDBody(parent);
|
||||||
//velocities
|
if(body == null){
|
||||||
Vector3d linearVel = PhysicsUtils.odeVecToJomlVec(body.getLinearVel());
|
LoggerInterface.loggerEngine.ERROR(new IllegalStateException("Running physics sync tree on entity that does not have a physics body!"));
|
||||||
Vector3d angularVel = PhysicsUtils.odeVecToJomlVec(body.getAngularVel());
|
} else {
|
||||||
//forces
|
//velocities
|
||||||
Vector3d linearForce = PhysicsUtils.odeVecToJomlVec(body.getForce());
|
Vector3d linearVel = PhysicsUtils.odeVecToJomlVec(body.getLinearVel());
|
||||||
Vector3d angularForce = PhysicsUtils.odeVecToJomlVec(body.getTorque());
|
Vector3d angularVel = PhysicsUtils.odeVecToJomlVec(body.getAngularVel());
|
||||||
if(position.distance(lastSentPosition) > UPDATE_THRESHOLD || 1.0 - rotation.dot(lastSentRotation) > UPDATE_THRESHOLD){
|
//forces
|
||||||
lastSentPosition.set(position);
|
Vector3d linearForce = PhysicsUtils.odeVecToJomlVec(body.getForce());
|
||||||
lastSentRotation.set(rotation);
|
Vector3d angularForce = PhysicsUtils.odeVecToJomlVec(body.getTorque());
|
||||||
DataCellSearchUtils.getEntityDataCell(parent).broadcastNetworkMessage(
|
if(position.distance(lastSentPosition) > UPDATE_THRESHOLD || 1.0 - rotation.dot(lastSentRotation) > UPDATE_THRESHOLD){
|
||||||
EntityMessage.constructsyncPhysicsMessage(
|
lastSentPosition.set(position);
|
||||||
parent.getId(),
|
lastSentRotation.set(rotation);
|
||||||
Globals.timekeeper.getNumberOfSimFramesElapsed(),
|
DataCellSearchUtils.getEntityDataCell(parent).broadcastNetworkMessage(
|
||||||
position.x,
|
EntityMessage.constructsyncPhysicsMessage(
|
||||||
position.y,
|
parent.getId(),
|
||||||
position.z,
|
Globals.timekeeper.getNumberOfSimFramesElapsed(),
|
||||||
rotation.x,
|
position.x,
|
||||||
rotation.y,
|
position.y,
|
||||||
rotation.z,
|
position.z,
|
||||||
rotation.w,
|
rotation.x,
|
||||||
linearVel.x,
|
rotation.y,
|
||||||
linearVel.y,
|
rotation.z,
|
||||||
linearVel.z,
|
rotation.w,
|
||||||
angularVel.x,
|
linearVel.x,
|
||||||
angularVel.y,
|
linearVel.y,
|
||||||
angularVel.z,
|
linearVel.z,
|
||||||
linearForce.x,
|
angularVel.x,
|
||||||
linearForce.y,
|
angularVel.y,
|
||||||
linearForce.z,
|
angularVel.z,
|
||||||
angularForce.x,
|
linearForce.x,
|
||||||
angularForce.y,
|
linearForce.y,
|
||||||
angularForce.z
|
linearForce.z,
|
||||||
)
|
angularForce.x,
|
||||||
);
|
angularForce.y,
|
||||||
|
angularForce.z
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,6 +111,7 @@ public class ServerPhysicsSyncTree implements BehaviorTree {
|
|||||||
* @param tree The behavior tree to detach
|
* @param tree The behavior tree to detach
|
||||||
*/
|
*/
|
||||||
public static void detachTree(Entity entity, BehaviorTree tree){
|
public static void detachTree(Entity entity, BehaviorTree tree){
|
||||||
|
ServerBehaviorTreeUtils.detatchBTreeFromEntity(entity, tree);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -431,7 +431,7 @@ public class ItemUtils {
|
|||||||
if(item.containsKey(EntityDataStrings.PHYSICS_COLLISION_BODY) && item.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){
|
if(item.containsKey(EntityDataStrings.PHYSICS_COLLISION_BODY) && item.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){
|
||||||
//destroy physics
|
//destroy physics
|
||||||
//this deregisters from all four & unhooks rigid bodies from the physics runtime
|
//this deregisters from all four & unhooks rigid bodies from the physics runtime
|
||||||
Globals.clientSceneWrapper.getCollisionEngine().destroyEntityThatHasPhysics(item);
|
Globals.clientSceneWrapper.getCollisionEngine().destroyPhysics(item);
|
||||||
//destroy hitboxes
|
//destroy hitboxes
|
||||||
HitboxCollectionState.destroyHitboxState(item);
|
HitboxCollectionState.destroyHitboxState(item);
|
||||||
//destroy graphics
|
//destroy graphics
|
||||||
|
|||||||
@ -91,7 +91,7 @@ public class PhysicsDataCell {
|
|||||||
*/
|
*/
|
||||||
public void destroyPhysics(){
|
public void destroyPhysics(){
|
||||||
Realm realm = Globals.realmManager.getEntityRealm(physicsEntity);
|
Realm realm = Globals.realmManager.getEntityRealm(physicsEntity);
|
||||||
realm.getCollisionEngine().destroyEntityThatHasPhysics(physicsEntity);
|
realm.getCollisionEngine().destroyPhysics(physicsEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -61,7 +61,7 @@ public class ServerBehaviorTreeUtils {
|
|||||||
entityBTreeMap.get(entity).remove(behaviorTree);
|
entityBTreeMap.get(entity).remove(behaviorTree);
|
||||||
//deregister from cell
|
//deregister from cell
|
||||||
ServerDataCell currentCell = DataCellSearchUtils.getEntityDataCell(entity);
|
ServerDataCell currentCell = DataCellSearchUtils.getEntityDataCell(entity);
|
||||||
currentCell.getScene().registerBehaviorTree(behaviorTree);
|
currentCell.getScene().deregisterBehaviorTree(behaviorTree);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user