collision

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
aiman
Posts: 19
Joined: Thu Nov 06, 2014 5:04 pm

collision

Post by aiman »

i use this code

Code: Select all

core::line3d<f32> ray;
            ray.start = secondarycamera->getPosition();
            ray.end = ray.start + (secondarycamera->getTarget() - ray.start).normalize() * 1000.0f;
 
            core::vector3df intersection;
            core::triangle3df hitTriangle;
 
            selectedSceneNode1 =
                collMan->getSceneNodeAndCollisionPointFromRay(
                ray,
                intersection, // This will be the position of the collision
                hitTriangle, // This will be the triangle hit in the collision
                IDFlag_IsPickable, // This ensures that only nodes that we have
                // set up to be pickable are considered
                0);
i catch one node
I want to catch all nodes between begine of ray and end of ray
vivekSivamRP
Posts: 66
Joined: Sat Sep 29, 2012 11:58 am

Re: collision

Post by vivekSivamRP »

Loop the above code by hiding the node collided with ray until you receive null for 'selectedSceneNode1'.

Code: Select all

 
firstEntry = true
while(selectedSceneNode1 || firstEntry) {
            if(firstEntry == false){
                   selectedSceneNode1->setVisible(false);
                  //  store 'selectedSceneNode1' in any containers to reset its visibility later
            }
            firstEntry = false
             selectedSceneNode1 = collMan->getSceneNodeAndCollisionPointFromRay(
                       ray,
                       intersection,
                       hitTriangle, 
                       IDFlag_IsPickable,
                     0);
 
}
 
thanhle
Posts: 325
Joined: Wed Jun 12, 2013 8:09 am

Re: collision

Post by thanhle »

Or maybe make a function that return a list of sceneNodes and collision points. E.g. create getSceneNodesAndCollisionPointsFromRay(...)

Then submit a patch or something. That way we have new function in new Irrlicht version ^^.

Ps: "Just a suggestion. Don't kill me for it."
Regards
thanh
aiman
Posts: 19
Joined: Thu Nov 06, 2014 5:04 pm

Re: collision

Post by aiman »

thank you
Post Reply