I've already searched different forums but couldn't find any solution for this topic.
I have a scenenode with a camera behind it (3rd Person View).
I perform a ray for detecting things in front of the character:
Code: Select all
core::line3d<f32> ray;
core::vector2d<s32> pos;
//Pixel festlegen:
pos.Y = 300; //Damit der Ray ein bisschen weiter oben anzielt
pos.X = 800;
ray = collMan->getRayFromScreenCoordinates(pos,Camera);
core::vector3df intersection;
core::triangle3df hitTriangle;
scene::ISceneNode * selectedSceneNode = collMan->getSceneNodeAndCollisionPointFromRay(ray,intersection, hitTriangle);
Code: Select all
if(selectedSceneNode)
{
bill->setPosition(intersection);
// We need to reset the transform before doing our own rendering.
driver->setTransform(video::ETS_WORLD, core::matrix4());
driver->setMaterial(material);
driver->draw3DTriangle(hitTriangle, video::SColor(0,255,0,0));
}
For example if you look at this screenshot:
The red dot is my ray. Only a few triangles of the character react on my clickEvent. Most of the reacting triangles are in the area of the head or shoulders, only a few triangles in the lower area react.
Another SceneNode I imported is only hardly clickable. I have to perform a lot of clicks on different triangles of the scenenode to get a reaction from it.
I don't think that my ClickEvent is wrong.
Things I tried:
- Recalculate the outside of the 3d-object via Blender
- tried different driver types
- changed rotation/size of the scenenodes
If I increase the size of the scenenodes, more and other triangles are getting clickable.
I just can't get it working correctly.
Does somebody have any ideas what I can do to solve this problem?
Thanks a lot,
tobmaster