Test visibility between 'objects' (solids and transparents?)

varoudis
Posts: 5
Joined: Sat Jan 22, 2011 11:24 am

Test visibility between 'objects' (solids and transparents?)

Post by varoudis »

Hello,

Let me describe what I need to do: in a very *simplified* form!

Image

In a 2d software that I have I can divide the space in boxes and I can check the inter-visibility between the boxes. The boxes represent the open space and the "black/empty" are solid walls. "Red" means that this box can "see" more boxes, "blue" is less.

Now, I want to do a similar thing in 3d and I wanted to use a collision world with raycasts to test visibility.

Image

Do you think this is possible? I need to be able to mark objects as transparent and solid. (the marked big box in the middle should be the solid one)

Any example to read? or something else?

Thanks a lot!
If something is not clear, let me know!

Tasos
xexuxjy
Posts: 225
Joined: Wed Jan 07, 2009 11:43 am
Location: London

Re: Test visibility between 'objects' (solids and transparen

Post by xexuxjy »

First thought is that you should be able to do something like :

Create a number of CollisionObjects with a box collision shape.
put a marker on each object via UserPointer to say if it's a solid or transparent.
go through each CollObject and do a collision world ray test with an all hits callback from each face, check the user pointer on the returned objects and see if it's a solid or transparent.
update your grid accordingly.

I'm sure there are much better ways , but the above 'should' work.