1. ## Projecting a Ray

I've been looking through all of the ClanLib documentation and classes/functions for a bit now and have to say I'm quite impressed with what the engine can do. I'll be using it for a class project and the professor wants to make sure that the engine is able to meet all of his requirements. He told me to try to find a function or class that handles projections of a ray to/through a wall that we can use for pathfinding/AI. I saw that there is collision detection which looks amazing, but is there a class for taking a set of lines/rays from the sprite and projecting it forward a certain distance to check for the collision? If not I can write something on my own for use with the project, but I figured I would ask here to see if anyone knew about it or where I could start looking. I'll keep looking around the documentation and if I find anything, I'll come back and post it here as well.

2. We have various line ray classes ( See http://clanlib.org/wiki/MainDocs:Math_and_Algorithms )

A ray has a start point and a direction
http://clanlib.org/docs/clanlib-2.2/...LineRay2f.html
http://clanlib.org/docs/clanlib-2.2/...LineRay3f.html

A line of infinite length is defined as 2 known points on the line
http://clanlib.org/docs/clanlib-2.2/...L__Line2f.html
http://clanlib.org/docs/clanlib-2.2/...L__Line3f.html

A line segment has a start point and an end point (thus finite length)
http://clanlib.org/docs/clanlib-2.2/...Segment2f.html
http://clanlib.org/docs/clanlib-2.2/...Segment3f.html

These are floating point. We also have double precision and integer

The line ray classes are very limited (nobody has submitted a patch to extend them).

For 2D, we have CL_LineSegment2f::get_intersection() and CL_Line2f::get_intersection()

(Tests for these math functions are in Tests/Core/Math)

But I can't help with exactly what you want. I'm not familiar enough with the API

3. Oh awesome. I hadn't made it that far in the documentation when I posted the thread. I'll skim through the API a little better next time as well. I think either the rays or even line segments would be perfect for what we need to do. My friend and I will be making a tactics game (with a twist) and just need to be able to project rays as part of the specifications of the project and it will help us create AI that can detect collisions before deciding on which direction to move.

Thanks for taking the time to help, it's greatly appreciated.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•