physics.space: Add point casting.
This commit is contained in:
@@ -75,6 +75,18 @@ is
|
|||||||
function cast_Ray (Self : access Item; From, To : in Vector_3) return ray_Collision is abstract;
|
function cast_Ray (Self : access Item; From, To : in Vector_3) return ray_Collision is abstract;
|
||||||
|
|
||||||
|
|
||||||
|
--- Point Casting
|
||||||
|
--
|
||||||
|
|
||||||
|
type point_Collision is
|
||||||
|
record
|
||||||
|
near_Object : Object.view;
|
||||||
|
Site_world : Vector_3;
|
||||||
|
end record;
|
||||||
|
|
||||||
|
function cast_Point (Self : access Item; Point : in Vector_3) return point_Collision is abstract;
|
||||||
|
|
||||||
|
|
||||||
--- Bounds
|
--- Bounds
|
||||||
--
|
--
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ with
|
|||||||
box2d_c.Binding,
|
box2d_c.Binding,
|
||||||
box2d_c.b2d_Contact,
|
box2d_c.b2d_Contact,
|
||||||
box2d_c.b2d_ray_Collision,
|
box2d_c.b2d_ray_Collision,
|
||||||
|
box2d_c.b2d_point_Collision,
|
||||||
|
|
||||||
box2d_physics.Shape,
|
box2d_physics.Shape,
|
||||||
box2d_physics.Joint,
|
box2d_physics.Joint,
|
||||||
@@ -452,6 +453,29 @@ is
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
overriding
|
||||||
|
function cast_Point (Self : access Item; Point : in Vector_3) return physics.Space.point_Collision
|
||||||
|
is
|
||||||
|
the_Collision : physics.Space.point_Collision;
|
||||||
|
c_Point : aliased c_math_c.Vector_3.item := +Point;
|
||||||
|
the_c_Collision : constant box2d_c.b2d_point_Collision.item := b2d_Space_cast_Point (Self.C, c_Point'unchecked_Access);
|
||||||
|
|
||||||
|
begin
|
||||||
|
if the_c_Collision.near_Object /= null
|
||||||
|
then
|
||||||
|
new_Line;
|
||||||
|
Put_Line ("box2d_Physics.Space.cast_Point ~ the_c_Collision.near_Object = " & the_c_Collision.near_Object'Image);
|
||||||
|
the_Collision.near_Object := to_Object_view (b2d_Object_user_Data (the_c_Collision.near_Object));
|
||||||
|
end if;
|
||||||
|
|
||||||
|
the_Collision.Site_world := +the_c_Collision.Site_world;
|
||||||
|
|
||||||
|
return the_Collision;
|
||||||
|
end cast_Point;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
overriding
|
overriding
|
||||||
procedure evolve (Self : in out Item; By : in Duration)
|
procedure evolve (Self : in out Item; By : in Duration)
|
||||||
is
|
is
|
||||||
|
|||||||
@@ -203,6 +203,8 @@ private
|
|||||||
overriding
|
overriding
|
||||||
function cast_Ray (Self : access Item; From, To : in Vector_3) return physics.Space.ray_Collision;
|
function cast_Ray (Self : access Item; From, To : in Vector_3) return physics.Space.ray_Collision;
|
||||||
overriding
|
overriding
|
||||||
|
function cast_Point (Self : access Item; Point : in Vector_3) return physics.Space.point_Collision;
|
||||||
|
overriding
|
||||||
procedure add (Self : in out Item; the_Joint : in physics.Joint.view);
|
procedure add (Self : in out Item; the_Joint : in physics.Joint.view);
|
||||||
overriding
|
overriding
|
||||||
procedure rid (Self : in out Item; the_Joint : in physics.Joint.view);
|
procedure rid (Self : in out Item; the_Joint : in physics.Joint.view);
|
||||||
|
|||||||
@@ -415,6 +415,19 @@ is
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
overriding
|
||||||
|
function cast_Point (Self : access Item; Point : in Vector_3) return physics.Space.point_Collision
|
||||||
|
is
|
||||||
|
Result : physics.Space.point_Collision;
|
||||||
|
begin
|
||||||
|
raise Program_Error with "TODO";
|
||||||
|
return Result;
|
||||||
|
end cast_Point;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
overriding
|
overriding
|
||||||
procedure evolve (Self : in out Item; By : in Duration)
|
procedure evolve (Self : in out Item; By : in Duration)
|
||||||
is
|
is
|
||||||
|
|||||||
@@ -189,6 +189,9 @@ private
|
|||||||
overriding
|
overriding
|
||||||
function cast_Ray (Self : access Item; From,
|
function cast_Ray (Self : access Item; From,
|
||||||
To : in Vector_3) return physics.Space.ray_Collision;
|
To : in Vector_3) return physics.Space.ray_Collision;
|
||||||
|
overriding
|
||||||
|
function cast_Point (Self : access Item; Point : in Vector_3) return physics.Space.point_Collision;
|
||||||
|
|
||||||
|
|
||||||
overriding
|
overriding
|
||||||
procedure evolve (Self : in out Item; By : in Duration);
|
procedure evolve (Self : in out Item; By : in Duration);
|
||||||
|
|||||||
Reference in New Issue
Block a user