LOD components re-attach physics
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2025-05-25 11:14:36 -04:00
parent bdcdc266cd
commit d812393d4c
4 changed files with 16 additions and 3 deletions

View File

@ -1,3 +1,3 @@
#maven.buildNumber.plugin properties file #maven.buildNumber.plugin properties file
#Sun May 25 09:48:39 EDT 2025 #Sun May 25 10:30:51 EDT 2025
buildNumber=634 buildNumber=635

View File

@ -1987,6 +1987,7 @@ Performance improvements
- Behavior tree addition/subtraction from scene optimization - Behavior tree addition/subtraction from scene optimization
- Reduce bones on LOD human model - Reduce bones on LOD human model
Increase human move speed Increase human move speed
LOD components re-attach physics

View File

@ -3,11 +3,13 @@ package electrosphere.entity.state.lod;
import electrosphere.collision.PhysicsEntityUtils; import electrosphere.collision.PhysicsEntityUtils;
import electrosphere.collision.PhysicsUtils; import electrosphere.collision.PhysicsUtils;
import electrosphere.data.entity.common.CommonEntityType;
import electrosphere.engine.Globals; import electrosphere.engine.Globals;
import electrosphere.entity.EntityDataStrings; import electrosphere.entity.EntityDataStrings;
import electrosphere.entity.Entity; import electrosphere.entity.Entity;
import electrosphere.net.synchronization.enums.BehaviorTreeIdEnums; import electrosphere.net.synchronization.enums.BehaviorTreeIdEnums;
import electrosphere.entity.btree.BehaviorTree; import electrosphere.entity.btree.BehaviorTree;
import electrosphere.entity.types.common.CommonEntityUtils;
import electrosphere.net.synchronization.annotation.SyncedField; import electrosphere.net.synchronization.annotation.SyncedField;
import electrosphere.net.synchronization.annotation.SynchronizedBehaviorTree; import electrosphere.net.synchronization.annotation.SynchronizedBehaviorTree;
@ -38,7 +40,10 @@ public class ClientLODComponent implements BehaviorTree {
if(cachedLodLevel != lodLevel){ if(cachedLodLevel != lodLevel){
cachedLodLevel = lodLevel; cachedLodLevel = lodLevel;
if(cachedLodLevel == ServerLODComponent.FULL_RES){ if(cachedLodLevel == ServerLODComponent.FULL_RES){
CommonEntityType type = CommonEntityUtils.getCommonData(this.parent);
if(type.getCollidable() != null){
PhysicsEntityUtils.clientAttachCollidableTemplate(parent, type.getCollidable());
}
} else if(cachedLodLevel == ServerLODComponent.LOW_RES){ } else if(cachedLodLevel == ServerLODComponent.LOW_RES){
if(PhysicsEntityUtils.containsDBody(this.parent)){ if(PhysicsEntityUtils.containsDBody(this.parent)){
PhysicsUtils.destroyPhysicsPair( PhysicsUtils.destroyPhysicsPair(

View File

@ -5,6 +5,7 @@ import org.joml.Vector3d;
import electrosphere.collision.PhysicsEntityUtils; import electrosphere.collision.PhysicsEntityUtils;
import electrosphere.collision.PhysicsUtils; import electrosphere.collision.PhysicsUtils;
import electrosphere.data.entity.common.CommonEntityType;
import electrosphere.engine.Globals; import electrosphere.engine.Globals;
import electrosphere.entity.EntityDataStrings; import electrosphere.entity.EntityDataStrings;
import electrosphere.entity.EntityUtils; import electrosphere.entity.EntityUtils;
@ -16,6 +17,7 @@ import electrosphere.entity.Entity;
import electrosphere.net.synchronization.enums.BehaviorTreeIdEnums; import electrosphere.net.synchronization.enums.BehaviorTreeIdEnums;
import electrosphere.server.datacell.utils.ServerBehaviorTreeUtils; import electrosphere.server.datacell.utils.ServerBehaviorTreeUtils;
import electrosphere.entity.btree.BehaviorTree; import electrosphere.entity.btree.BehaviorTree;
import electrosphere.entity.types.common.CommonEntityUtils;
import electrosphere.net.synchronization.annotation.SyncedField; import electrosphere.net.synchronization.annotation.SyncedField;
import electrosphere.net.synchronization.annotation.SynchronizedBehaviorTree; import electrosphere.net.synchronization.annotation.SynchronizedBehaviorTree;
@ -59,6 +61,11 @@ public class ServerLODComponent implements BehaviorTree {
if(lodLevel != FULL_RES){ if(lodLevel != FULL_RES){
//make full res //make full res
this.setLodLevel(FULL_RES); this.setLodLevel(FULL_RES);
Realm realm = Globals.serverState.realmManager.getEntityRealm(this.parent);
CommonEntityType type = CommonEntityUtils.getCommonData(this.parent);
if(type.getCollidable() != null){
PhysicsEntityUtils.serverAttachCollidableTemplate(realm, this.parent, type.getCollidable());
}
} }
} else { } else {
if(lodLevel != LOW_RES){ if(lodLevel != LOW_RES){