server physics destruction fix
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
3e89dd9224
commit
5bf5080f74
@ -2029,6 +2029,7 @@ Moving data packages around
|
|||||||
Fix client LOD component re-enabling physics positioning
|
Fix client LOD component re-enabling physics positioning
|
||||||
Debug rendering of server physics objects
|
Debug rendering of server physics objects
|
||||||
Server LOD component properly attaches physics bodies when the entity comes in range
|
Server LOD component properly attaches physics bodies when the entity comes in range
|
||||||
|
Fix physics destruction on server via ServerLODComponent
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -867,6 +867,24 @@ public class PhysicsEntityUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroys the physics attached to an entity without outright destroying the entity
|
||||||
|
* @param entity The entity
|
||||||
|
*/
|
||||||
|
public static void serverDestroyPhysics(Entity entity){
|
||||||
|
Realm realm = Globals.serverState.realmManager.getEntityRealm(entity);
|
||||||
|
if(PhysicsEntityUtils.containsDBody(entity)){
|
||||||
|
PhysicsUtils.destroyPhysicsPair(
|
||||||
|
realm.getCollisionEngine(),
|
||||||
|
PhysicsEntityUtils.getDBody(entity),
|
||||||
|
PhysicsEntityUtils.getCollidable(entity)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
PhysicsEntityUtils.setCollidable(entity, null);
|
||||||
|
Vector3d entityPos = EntityUtils.getPosition(entity);
|
||||||
|
ServerEntityUtils.repositionEntity(entity, entityPos);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the transform from parent entity position to rigid body
|
* Gets the transform from parent entity position to rigid body
|
||||||
* @param entity The entity
|
* @param entity The entity
|
||||||
|
|||||||
@ -4,7 +4,6 @@ package electrosphere.entity.state.lod;
|
|||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
|
|
||||||
import electrosphere.collision.PhysicsEntityUtils;
|
import electrosphere.collision.PhysicsEntityUtils;
|
||||||
import electrosphere.collision.PhysicsUtils;
|
|
||||||
import electrosphere.data.entity.common.CommonEntityType;
|
import electrosphere.data.entity.common.CommonEntityType;
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
import electrosphere.entity.EntityDataStrings;
|
import electrosphere.entity.EntityDataStrings;
|
||||||
@ -71,14 +70,7 @@ public class ServerLODComponent implements BehaviorTree {
|
|||||||
if(this.lodLevel != LOW_RES){
|
if(this.lodLevel != LOW_RES){
|
||||||
//make low res
|
//make low res
|
||||||
this.setLodLevel(LOW_RES);
|
this.setLodLevel(LOW_RES);
|
||||||
Realm realm = Globals.serverState.realmManager.getEntityRealm(this.parent);
|
PhysicsEntityUtils.serverDestroyPhysics(this.parent);
|
||||||
if(PhysicsEntityUtils.containsDBody(this.parent)){
|
|
||||||
PhysicsUtils.destroyPhysicsPair(
|
|
||||||
realm.getCollisionEngine(),
|
|
||||||
PhysicsEntityUtils.getDBody(this.parent),
|
|
||||||
PhysicsEntityUtils.getCollidable(this.parent)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user