voxel lookup alignment
Some checks reported errors
studiorailgun/Renderer/pipeline/head Something is wrong with the build of this commit
Some checks reported errors
studiorailgun/Renderer/pipeline/head Something is wrong with the build of this commit
This commit is contained in:
parent
c8696226f0
commit
e64c23f7f8
@ -1549,6 +1549,7 @@ Fab tool can show transparent, loaded version of fab file
|
|||||||
Interaction target tooltip at top of window
|
Interaction target tooltip at top of window
|
||||||
Interaction target tooltip shows entity target, voxel targets
|
Interaction target tooltip shows entity target, voxel targets
|
||||||
Fix bug where inventory items aren't destroying physics on server
|
Fix bug where inventory items aren't destroying physics on server
|
||||||
|
Align voxel lookups for movement audio and interaction targeting
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -261,7 +261,11 @@ public class ClientInteractionEngine {
|
|||||||
}
|
}
|
||||||
if(!set){
|
if(!set){
|
||||||
Vector3d collisionPosition = Globals.clientSceneWrapper.getCollisionEngine().rayCastPosition(centerPos, new Vector3d(eyePos).mul(-1), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
Vector3d collisionPosition = Globals.clientSceneWrapper.getCollisionEngine().rayCastPosition(centerPos, new Vector3d(eyePos).mul(-1), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
||||||
if(collisionPosition != null && collisionPosition.distance(centerPos) < CollisionEngine.DEFAULT_INTERACT_DISTANCE){
|
if(
|
||||||
|
collisionPosition != null &&
|
||||||
|
collisionPosition.distance(centerPos) < CollisionEngine.DEFAULT_INTERACT_DISTANCE &&
|
||||||
|
collisionPosition.x >= 0 && collisionPosition.y >= 0 && collisionPosition.z >= 0
|
||||||
|
){
|
||||||
//grab block at point
|
//grab block at point
|
||||||
BlockChunkData blockChunkData = Globals.clientBlockManager.getChunkDataAtWorldPoint(Globals.clientWorldData.convertRealToWorldSpace(collisionPosition), 0);
|
BlockChunkData blockChunkData = Globals.clientBlockManager.getChunkDataAtWorldPoint(Globals.clientWorldData.convertRealToWorldSpace(collisionPosition), 0);
|
||||||
if(blockChunkData != null){
|
if(blockChunkData != null){
|
||||||
@ -277,7 +281,7 @@ public class ClientInteractionEngine {
|
|||||||
if(!set){
|
if(!set){
|
||||||
ChunkData chunkData = Globals.clientTerrainManager.getChunkDataAtWorldPoint(Globals.clientWorldData.convertRealToWorldSpace(collisionPosition), 0);
|
ChunkData chunkData = Globals.clientTerrainManager.getChunkDataAtWorldPoint(Globals.clientWorldData.convertRealToWorldSpace(collisionPosition), 0);
|
||||||
if(chunkData != null){
|
if(chunkData != null){
|
||||||
int voxelType = chunkData.getType(Globals.clientWorldData.convertRealToVoxelSpace(collisionPosition));
|
int voxelType = chunkData.getType(Globals.clientWorldData.convertRealToVoxelSpace(new Vector3d(collisionPosition).add(new Vector3d(ServerTerrainChunk.VOXEL_SIZE / 2.0f))));
|
||||||
if(voxelType != ServerTerrainChunk.VOXEL_TYPE_AIR){
|
if(voxelType != ServerTerrainChunk.VOXEL_TYPE_AIR){
|
||||||
String text = Globals.gameConfigCurrent.getVoxelData().getTypeFromId(voxelType).getName();
|
String text = Globals.gameConfigCurrent.getVoxelData().getTypeFromId(voxelType).getName();
|
||||||
InteractionTargetMenu.setInteractionTargetString(text);
|
InteractionTargetMenu.setInteractionTargetString(text);
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import electrosphere.client.terrain.cache.ChunkData;
|
|||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.EntityUtils;
|
import electrosphere.entity.EntityUtils;
|
||||||
|
import electrosphere.server.physics.terrain.manager.ServerTerrainChunk;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Samples voxels
|
* Samples voxels
|
||||||
@ -24,7 +25,7 @@ public class ClientVoxelSampler {
|
|||||||
* @return The voxel type, INVALID_POSITION if the position queried is invalid
|
* @return The voxel type, INVALID_POSITION if the position queried is invalid
|
||||||
*/
|
*/
|
||||||
public static int getVoxelTypeBeneathEntity(Entity entity){
|
public static int getVoxelTypeBeneathEntity(Entity entity){
|
||||||
return ClientVoxelSampler.getVoxelType(EntityUtils.getPosition(entity));
|
return ClientVoxelSampler.getVoxelType(new Vector3d(EntityUtils.getPosition(entity)).add(new Vector3d(ServerTerrainChunk.VOXEL_SIZE / 2.0f)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -168,6 +168,9 @@ public class ServerDataCell {
|
|||||||
case COMMON: {
|
case COMMON: {
|
||||||
CommonEntityUtils.sendEntityToPlayer(player, entity);
|
CommonEntityUtils.sendEntityToPlayer(player, entity);
|
||||||
} break;
|
} break;
|
||||||
|
case ENGINE: {
|
||||||
|
//silently ignore
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,10 +12,15 @@ import electrosphere.server.physics.terrain.models.TerrainModification;
|
|||||||
*/
|
*/
|
||||||
public class ServerTerrainChunk {
|
public class ServerTerrainChunk {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Size of a single voxel
|
||||||
|
*/
|
||||||
|
public static final int VOXEL_SIZE = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All chunks are 16x16x16
|
* All chunks are 16x16x16
|
||||||
*/
|
*/
|
||||||
public static final int CHUNK_DIMENSION = 16;
|
public static final int CHUNK_DIMENSION = 16 * VOXEL_SIZE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The size of the data passed into marching cubes/transvoxel to generate a fully connected and seamless chunk
|
* The size of the data passed into marching cubes/transvoxel to generate a fully connected and seamless chunk
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user