Crystal Space
Welcome, Guest. Please login or register.
October 24, 2014, 12:25:59 pm

Login with username, password and session length
Search:     Advanced search
9011 Posts in 2044 Topics by 8812 Members
Latest Member: Beverlychoi
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Development
| |-+  General Crystal Space Discussion
| | |-+  Any ray/line intersection function?
« previous next »
Pages: [1] Print
Author Topic: Any ray/line intersection function?  (Read 3237 times)
PicklJuic
Newbie
*
Posts: 1


View Profile
« on: May 17, 2005, 08:43:26 am »

Hello there,

  I was looking around for an engine to use for a game, and CS looks pretty cool- I think I may end up using it, even though it's learning curve is steeper than some others.

....But I had a question... I have made some code already in another engine. I got as far as using an algorythm to "probe" the terrain to store info for pathfinding. This code uses an API function in that other engine which basically scans for a collision with a "line" through 3d space. This returns the collision point of the first collision it encounters, and then I use that info to store for my pathfinding/AI....

...Problem is, I have not seen something like this yet- maybe I am missing something? Does such a function exist?


This is a quick snippet of the function from that engines API docs to show what I mean:

Code:

int iBodyScan(BODY*,D3DXVECTOR3*,D3DXVECTOR3*,float,D3DXVECTOR3*,D3DXVECTOR3*)
   Return subpart hit by the scan, or -1 if nothing is hit by the scan.
   BODY* = body object to scan
   D3DXVECTOR3* = scan origin
   D3DXVECTOR3* = scan direction. The length of this vector will be the length of the
                  scanning capsule.
   float = scan radius (capsule radius)
   D3DXVECTOR3* = contact point (absolute coordinates). Return data.
   NOTE: the scan is performed checking the specified capsule against the specified body, for
   intersections. Only the intersection closer to origin is considered, in case the
   capsule intersects the body at two or more points.
   NOTE: a scan traversing a large number of polygons or dynamic body's spheres is
   computationally expensive. Furthermore, a scan traversing more than 100 polygons
   will miss some intersections.
   IMPORTANT: intersections within 'scan radius' from the 'scan origin' are not detected!
   Make sure your scan starts 'radius' meters before the possible intersection area.


...any help here would be greatly appreciated.

 Thanks! Smiley
Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #1 on: June 29, 2005, 11:33:03 am »

Quote from: PicklJuic
Hello there,

....But I had a question... I have made some code already in another engine. I got as far as using an algorythm to "probe" the terrain to store info for pathfinding. This code uses an API function in that other engine which basically scans for a collision with a "line" through 3d space. This returns the collision point of the first collision it encounters, and then I use that info to store for my pathfinding/AI....

...Problem is, I have not seen something like this yet- maybe I am missing something? Does such a function exist?

 Thanks! Smiley


Check out iSector->HitBeam or csColliderHelper::TraceBeam. The last one is faster but it is based on collision detection information and not the real model.

Greetings,
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 4.201 seconds with 15 queries.