diff --git a/assets/Data/entity/foliage/rocks.json b/assets/Data/entity/foliage/rocks.json index 7869f625..76eaa8e9 100644 --- a/assets/Data/entity/foliage/rocks.json +++ b/assets/Data/entity/foliage/rocks.json @@ -10,9 +10,9 @@ "onInteract" : "harvest", "interactionShape" : { "type" : "CUBE", - "dimension1" : 0.3, - "dimension2" : 0.3, - "dimension3" : 0.3, + "dimension1" : 0.4, + "dimension2" : 0.4, + "dimension3" : 0.4, "rotX": 0, "rotY": 0, "rotZ": 0, diff --git a/docs/src/progress/renderertodo.md b/docs/src/progress/renderertodo.md index e33cd069..5cb5b99b 100644 --- a/docs/src/progress/renderertodo.md +++ b/docs/src/progress/renderertodo.md @@ -1872,6 +1872,7 @@ Shuffle entity data package Rename structure -> virtualstructure Update hometown storage on characters Filter test scenes out of level selection +Visualize interaction engine collidables diff --git a/src/main/java/electrosphere/client/ui/menu/debug/render/ImGuiRenderer.java b/src/main/java/electrosphere/client/ui/menu/debug/render/ImGuiRenderer.java index eaa5f59f..fd4fea28 100644 --- a/src/main/java/electrosphere/client/ui/menu/debug/render/ImGuiRenderer.java +++ b/src/main/java/electrosphere/client/ui/menu/debug/render/ImGuiRenderer.java @@ -53,6 +53,9 @@ public class ImGuiRenderer { if(ImGui.button("Draw Grid Alignment Data")){ Globals.gameConfigCurrent.getSettings().setGraphicsDebugDrawGridAlignment(!Globals.gameConfigCurrent.getSettings().getGraphicsDebugDrawGridAlignment()); } + if(ImGui.button("Draw Interaction Collidable Data")){ + Globals.gameConfigCurrent.getSettings().setGraphicsDebugDrawInteractionCollidables(!Globals.gameConfigCurrent.getSettings().getGraphicsDebugDrawInteractionCollidables()); + } ImGui.unindent(); } if(ImGui.collapsingHeader("OpenGL Details")){ diff --git a/src/main/java/electrosphere/data/settings/UserSettings.java b/src/main/java/electrosphere/data/settings/UserSettings.java index 2bf62809..398feb77 100644 --- a/src/main/java/electrosphere/data/settings/UserSettings.java +++ b/src/main/java/electrosphere/data/settings/UserSettings.java @@ -52,6 +52,7 @@ public class UserSettings { boolean graphicsDebugDrawMovementVectors; boolean graphicsDebugDrawNavmesh; boolean graphicsDebugDrawGridAlignment; + boolean graphicsDebugDrawInteractionCollidables; //debug network boolean netRunNetMonitor; @@ -203,6 +204,21 @@ public class UserSettings { this.graphicsDebugDrawGridAlignment = graphicsDebugDrawGridAlignment; } + /** + * Checs if should render the interaction engine collidables + * @return true to render them, false otherwise + */ + public boolean getGraphicsDebugDrawInteractionCollidables() { + return graphicsDebugDrawInteractionCollidables; + } + + /** + * Sets whether should render the interaction engine collidables + * @param graphicsDebugDrawInteractionCollidables true to render, false otherwise + */ + public void setGraphicsDebugDrawInteractionCollidables(boolean graphicsDebugDrawInteractionCollidables) { + this.graphicsDebugDrawInteractionCollidables = graphicsDebugDrawInteractionCollidables; + } diff --git a/src/main/java/electrosphere/renderer/pipelines/debug/DebugContentPipeline.java b/src/main/java/electrosphere/renderer/pipelines/debug/DebugContentPipeline.java index 6f809bb9..aa830fd0 100644 --- a/src/main/java/electrosphere/renderer/pipelines/debug/DebugContentPipeline.java +++ b/src/main/java/electrosphere/renderer/pipelines/debug/DebugContentPipeline.java @@ -105,6 +105,18 @@ public class DebugContentPipeline implements RenderPipeline { } } + //render interaction engine collidables + if(Globals.gameConfigCurrent.getSettings().getGraphicsDebugDrawInteractionCollidables()){ + CollisionEngine engine = Globals.clientState.clientSceneWrapper.getInteractionEngine(); + for(Collidable collidable : engine.getCollidables()){ + Entity physicsEntity = collidable.getParent(); + if((boolean)physicsEntity.getData(EntityDataStrings.DATA_STRING_DRAW) && physicsEntity.getData(EntityDataStrings.INTERACTION_TEMPLATE) != null){ + CollidableTemplate template = (CollidableTemplate)physicsEntity.getData(EntityDataStrings.INTERACTION_TEMPLATE); + DebugContentPipeline.renderCollidable(openGLState, renderPipelineState, modelTransformMatrix, physicsEntity, template); + } + } + } + //render current structure data if( Globals.clientState.clientLevelEditorData.getCurrentFab() != null && @@ -231,7 +243,7 @@ public class DebugContentPipeline implements RenderPipeline { */ static void renderCollidable(OpenGLState openGLState, RenderPipelineState renderPipelineState, Matrix4d modelTransformMatrix, Entity physicsEntity, CollidableTemplate template){ Model physicsGraphicsModel; - if((boolean)physicsEntity.getData(EntityDataStrings.DATA_STRING_DRAW) && physicsEntity.getData(EntityDataStrings.PHYSICS_MODEL_TEMPLATE) != null){ + if((boolean)physicsEntity.getData(EntityDataStrings.DATA_STRING_DRAW)){ switch(template.getType()){ case CollidableTemplate.COLLIDABLE_TYPE_CYLINDER: { if((physicsGraphicsModel = Globals.assetManager.fetchModel(AssetDataStrings.UNITCYLINDER)) != null){ @@ -271,7 +283,7 @@ public class DebugContentPipeline implements RenderPipeline { } } break; case CollidableTemplate.COLLIDABLE_TYPE_CAPSULE: { - if((physicsGraphicsModel = Globals.assetManager.fetchModel(AssetDataStrings.UNITCAPSULE)) != null){ + if((physicsGraphicsModel = Globals.assetManager.fetchModel(AssetDataStrings.UNITCYLINDER)) != null){ //set color based on collision status, type, etc Texture texture = Globals.assetManager.fetchTexture(AssetDataStrings.TEXTURE_BLUE_TRANSPARENT); if(texture != null){