Collision detection with billboard node

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
_Dum0nde
Posts: 24
Joined: Thu Mar 17, 2005 3:26 pm

Collision detection with billboard node

Post by _Dum0nde »

Hi,

I'm trying to detect when the camera is aiming at a billboard node (a target). The problem is, the detection is only triggered in a small portion of the billboard (about only in the white square in the screenshot).

Image

When I look everywhere else, no collision happens... Is the collision linked with the size of the node? Here's the relevent code:

Code: Select all

for (int i = 0; i < nbTargets; ++ i) {
    billboards.push_back(hub->irr_scenemgr()->addBillboardSceneNode(node, core::dimension2d<f32>(40, 40)));
    billboards[i]->setMaterialFlag(video::EMF_LIGHTING, false);
    billboards[i]->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
}

// ...

if (hub->irr_scenemgr()->getSceneCollisionManager()->getSceneNodeFromCameraBB(camera) == billboards[0])
    billboards[0]->setMaterialTexture(0, texContourSurligne);
else
    billboards[0]->setMaterialTexture(0, texContour);
billboards[0]->setPosition(core::vector3df(direction.X, direction.Y + 15, direction.Z));

// ...
Thanks for the help!
bami
Posts: 20
Joined: Fri Apr 08, 2005 4:11 pm
Contact:

Post by bami »

It's probably just picking up the bits from the other models.
make EVERYTHING except the node currently checking invisible, then check, and make everything visible again. That way the player won't notice.

I had that in my game, where the camera was picking up the shadow/enviroment shadows.
_Dum0nde
Posts: 24
Joined: Thu Mar 17, 2005 3:26 pm

Post by _Dum0nde »

Actually, the scene is very simple... The map, the md2 model and the billboards which are always in front of the model. I tried making the model invisible, but it does the same thing.

The area of the target which triggers the collision (the white square) is the same on the 5 targets so I guess it can't be random bits of other models interfering...

Have you actually succeeded in making collision detection with billboards? Maybe the engine just doesn't care about the size of the node...
_Dum0nde
Posts: 24
Joined: Thu Mar 17, 2005 3:26 pm

Post by _Dum0nde »

I would also like to draw some text in those targets... 3d text doesn't seem to be supported (or is it?). Is my only option to render to texture and blend the two together?
NewYoda
Posts: 4
Joined: Sat Sep 17, 2005 11:28 am
Location: Thüringen

Post by NewYoda »

I have the same problem.
Has anyone solved this?
The Bounding Boxes of my BillboardSceneNodes allways have a wrong size of 2x2x2, but I used

Code: Select all

node = scene->addBillboardSceneNode(0,dimension2d<f32>(20,20),position);
Shouldn't my Billboards be 20x20x0?
Nikk

Post by Nikk »

The bounding box isn't set for billboard scene nodes, it seems to be not empty, but use the default bb values. It is, of course, logical that a billboard wouldn't have a 3d volume and instead a 2d dimension, which is where the size is stored for billboards, but for collision testing it is useful to use a bb with the size scaled from the dimension anyway.
Post Reply