# Tag Info

0

For optimizing voxel tracing, I can think of two different approaches: Multi-level mapping to skip larger empty volumes Ganged initial tracing, so that a single tracer handles the common parts of many rays Multi-level mapping means that you have an additional voxel map for blocks of k×k×k voxels. At minimum, each block is just a flag whether that block ...

1

First we'll subtract the cylinder center from the ray origin, to translate our whole problem to be centered at (0, 0, 0). Case 0: Inside First, check if the ray origin is inside the cylinder from the start. \text{origin}_x^2 + \text{origin}_z^2 \leq \text{radius}^2 \quad \text{and}\quad -\frac {\text{height}} 2 \leq \text{origin}_y \leq \frac {\text{height}...

0

Here is a full C99/C11 implementation of a simple voxel renderer. First, let's define vectors.h, for float3, float4, and int4 support: // SPDX-License-Identifier: CC0-1.0 // #ifndef VECTORS_H #define VECTORS_H #include <math.h> /* * float3 support */ typedef struct { float x; float y; float z; } float3; static inline float3 ...

1

(Apologies, I'm not familiar with Unity/HLSL at all, so my syntax may be wonky.) Let's restart, with float4 eye; // Player camera position, .w = 0 float4 proj0; // Corner of the projection plane, .w = 0 float4 projX; // Projection plane X axis, .w = 0 float4 projY; // Projection plane Y axis, .w = 0 so that picture plane pixel uint3 id is at ...

0

It looks like you might want something as simple as: transform.rotation = Quaternion.LookRotation(Vector3.forward, _raycastHit.normal); Or, if you rotate your character about the a axis to flip them, you can use transform.forward instead of Vector3.forward.

0

As @DMGregory pointed out, Collider2D.ClosestPoint was exactly what I was looking. And the question of why is 'RaycastHit2D.point' misbehaving, I still don't know. but I have a feeling it was because I was treating it like an expanding circle instead of it being static circle collider.

1

We can use the Tilemap's Grid to convert the world-space bounds of our selection rectangle into grid coordinates within the map: LayoutGrid grid = tilemap.layoutGrid; Vector3Int bottomLeftCell = grid.WorldToCell(bottomLeft); Vector3Int topRightCell = grid.WorldToCell(topRight); Vector3Int min = Vector3Int.Min(bottomLeftCell, topRightCell); Vector3Int max = ...

Top 50 recent answers are included