Attempts at raycast
This commit is contained in:
@@ -8,6 +8,7 @@ const math = @import("math.zig");
|
||||
const Blocks = @import("assets/Blocks.zig");
|
||||
const Chunks = @import("Chunks.zig");
|
||||
const Iterator2 = math.Iterator2;
|
||||
const Quaternion = math.Quaternion;
|
||||
const Vector2 = math.Vector2;
|
||||
const Vector3 = math.Vector3;
|
||||
const Vector2Int = math.Vector2Int;
|
||||
@@ -200,6 +201,8 @@ pub const ground_acceleration_sv = sv(56.12);
|
||||
pub const air_acceleration_sv = sv(56.12);
|
||||
pub const air_speed_limit_sv = sv(0.5612);
|
||||
|
||||
pub const raycast_length_sv = sv(5.0);
|
||||
|
||||
pub fn init(position_sv: Vector3Int, pitch_rad: f32, yaw_rad: f32) Player {
|
||||
return .{
|
||||
.position_sv = position_sv,
|
||||
@@ -229,6 +232,17 @@ pub fn onMouseMove(self: *Player, dx: f32, dy: f32) void {
|
||||
pub fn update(self: *Player, dt: f32, chunks: *const Chunks) void {
|
||||
defer self.resetAllButtons();
|
||||
|
||||
//const raycast_origin_sv = self.position_sv
|
||||
// .add(.init(0, 0, @intFromFloat(@round(c.sv_per_vx * camera_height_vx))));
|
||||
//const raycast_ray_sv = Vector3
|
||||
// .init(0, raycast_length_sv, 0)
|
||||
// .rotate(.mulQuaternion(
|
||||
// .initRotationXY(self.yaw_rad),
|
||||
// .initRotationYZ(self.pitch_rad),
|
||||
// ))
|
||||
// .asVector3Int();
|
||||
//const raycast_hit = chunks.raycast(raycast_origin_sv, raycast_ray_sv);
|
||||
|
||||
// --- GATHER INPUTS -------------------------------------------------------
|
||||
|
||||
const horizontal_input_vector_frac = blk: {
|
||||
|
||||
Reference in New Issue
Block a user