Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Problem with api_ray_fi re using an ENTITY_LIS T
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
03-28-2012 05:56 AM
Hi
I'm experiencing inconsistencies between the two signatures provided by the api_ray_fire(...) API. The one accepting a single ENTITY works as expected, but if I use the one accepting an ENTITY_LIST I get unexpected results. Is there a difference between the two versions of api_ray_fire()?
This little piece of code shows the problem:
BODY* body1 = 0;
BODY* body2 = 0;
{
API_BEGIN
result = api_solid_block(SPAposition(0,0,0), SPAposition(10,2,20), body1);
result = api_solid_block(SPAposition(20,0,0), SPAposition(30,2,20), body2);
API_END
}
ray test_ray( SPAposition(25,1,40), SPAunit_vector(0,0,-1), 100.0*SPAresabs, 1 );
// Single entity ray fire
{
entity_hit_list hit_list;
rayfire_options options;
API_NOP_BEGIN
result = api_ray_fire(body2, test_ray, hit_list, &options);
API_NOP_END
assert(hit_list.count() == 1); // This is fine
}
// Entity list ray fire
{
entity_hit_list hit_list;
rayfire_options options;
ENTITY_LIST list;
list.add(body1);
list.add(body2);
API_NOP_BEGIN
result = api_ray_fire(list, test_ray, hit_list, &options);
API_NOP_END
assert(hit_list.count() == 1); // This fails! hit_list.count() gives back zero.
}Thanks
Emilio

