grid alignment offsets work
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2025-05-14 20:25:12 -04:00
parent 97569c84f0
commit c06af65e46
3 changed files with 4 additions and 10 deletions

View File

@ -1783,6 +1783,7 @@ Grid aligned entity work
Grid alignment visualization work
Move around entity debug tab classes
Grid alignment data editing in debug menus
Grid alignment offsets work

View File

@ -346,15 +346,12 @@ public class CursorState {
* @param position The position
* @param data The data
*/
public static void nudgeGridAlignment(Vector3d position, GridAlignedData data){
private static void nudgeGridAlignment(Vector3d position, GridAlignedData data){
if(data.getWidth() / 2 == 1){
position.x = position.x + BlockChunkData.BLOCK_SIZE_MULTIPLIER / 2.0f;
}
if(data.getHeight() / 2 == 1){
position.y = position.y + BlockChunkData.BLOCK_SIZE_MULTIPLIER / 2.0f;
position.x = position.x - BlockChunkData.BLOCK_SIZE_MULTIPLIER / 2.0f;
}
if(data.getLength() / 2 == 1){
position.z = position.z + BlockChunkData.BLOCK_SIZE_MULTIPLIER / 2.0f;
position.z = position.z - BlockChunkData.BLOCK_SIZE_MULTIPLIER / 2.0f;
}
}

View File

@ -12,7 +12,6 @@ import org.ode4j.ode.DBody;
import electrosphere.client.interact.ClientInteractionEngine;
import electrosphere.collision.PhysicsEntityUtils;
import electrosphere.collision.collidable.Collidable;
import electrosphere.controls.cursor.CursorState;
import electrosphere.data.collidable.CollidableTemplate;
import electrosphere.data.common.CommonEntityType;
import electrosphere.data.creature.CreatureData;
@ -745,9 +744,6 @@ public class CommonEntityUtils {
//grid alignment
if(rawType.getGridAlignedData() != null){
Vector3d placementPos = realm.getServerWorldData().clampRealToBlock(position);
CursorState.nudgeGridAlignment(placementPos,rawType.getGridAlignedData());
position.set(placementPos);
Globals.clientScene.registerEntityToTag(entity, EntityTags.BLOCK_OCCUPANT);
//TODO: must register with all nearby scenes as well because it could possibly occupy other chunks
}