Skip to content

Commit 4f97222

Browse files
committed
Stuff
1 parent 25e73d6 commit 4f97222

1 file changed

Lines changed: 0 additions & 71 deletions

File tree

src/tiramisu/physics.gleam

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -594,52 +594,6 @@ pub fn get_body_transform_raw(
594594
Ok(#(translation, quaternion))
595595
}
596596

597-
/// Rotate a vector by a quaternion.
598-
///
599-
/// This is useful for transforming directions (like forward, right, up) by a body's rotation.
600-
///
601-
/// ## Example
602-
///
603-
/// ```gleam
604-
/// // Get vehicle's forward direction
605-
/// case physics.get_body_transform_raw(physics_world, vehicle_id) {
606-
/// Ok(#(_position, quat)) -> {
607-
/// let forward = physics.rotate_vector_by_quaternion(
608-
/// vec3.Vec3(0.0, 0.0, -1.0),
609-
/// quat
610-
/// )
611-
/// // Now forward points in the vehicle's forward direction
612-
/// }
613-
/// Error(_) -> vec3.Vec3(0.0, 0.0, -1.0)
614-
/// }
615-
/// ```
616-
pub fn rotate_vector_by_quaternion(v: Vec3(Float), q: Quaternion) -> Vec3(Float) {
617-
// Quaternion-vector rotation formula: v' = q * v * q^-1
618-
// Optimized formula: v' = v + 2 * cross(q.xyz, cross(q.xyz, v) + q.w * v)
619-
let qx = q.x
620-
let qy = q.y
621-
let qz = q.z
622-
let qw = q.w
623-
624-
// First cross product: q.xyz × v
625-
let cx1 = qy *. v.z -. qz *. v.y
626-
let cy1 = qz *. v.x -. qx *. v.z
627-
let cz1 = qx *. v.y -. qy *. v.x
628-
629-
// Add q.w * v
630-
let tx = cx1 +. qw *. v.x
631-
let ty = cy1 +. qw *. v.y
632-
let tz = cz1 +. qw *. v.z
633-
634-
// Second cross product: q.xyz × t
635-
let cx2 = qy *. tz -. qz *. ty
636-
let cy2 = qz *. tx -. qx *. tz
637-
let cz2 = qx *. ty -. qy *. tx
638-
639-
// Final result: v + 2 * cross result
640-
vec3.Vec3(v.x +. 2.0 *. cx2, v.y +. 2.0 *. cy2, v.z +. 2.0 *. cz2)
641-
}
642-
643597
// --- Forces and Impulses (Functional API) ---
644598

645599
/// Queue a force to be applied to a rigid body during the next physics step.
@@ -829,31 +783,6 @@ pub fn raycast(
829783
}
830784
}
831785

832-
/// Cast a ray and return all hits along the ray
833-
///
834-
/// Returns hits sorted by distance (closest first).
835-
///
836-
/// ## Example
837-
///
838-
/// ```gleam
839-
/// // Check what's in front of the player
840-
/// let hits = physics.raycast_all(world, origin, direction, max_distance: 100.0)
841-
///
842-
/// // Find first enemy hit
843-
/// let enemy_hit = list.find(hits, fn(hit) {
844-
/// string.starts_with(hit.body_id, "enemy_")
845-
/// })
846-
/// ```
847-
pub fn raycast_all(
848-
_world: PhysicsWorld(id),
849-
origin _origin: Vec3(Float),
850-
direction _direction: Vec3(Float),
851-
max_distance _max_distance: Float,
852-
) -> List(RaycastHit(id)) {
853-
// TODO: Implement using Rapier's intersectionsWithRay
854-
[]
855-
}
856-
857786
/// Get all collision events that occurred during the last physics step.
858787
///
859788
/// Events are automatically collected when `step()` is called and stored in the world.

0 commit comments

Comments
 (0)