Targeting another Object (or player)

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Van
Posts: 9
Joined: Fri Oct 29, 2004 3:31 am

Targeting another Object (or player)

Post by Van »

We are writing a space game where you need to "target" another object (or player, etc). We are not sure the best way to go about doing this.

We made a 2D bitmap to "highlight" the tarket (just a square box). But, we are not sure how to place the 2D item on a 3D item. To complicate matters, the targetable item may not be in the camera view.

We would like our "target highlighter" to give the general direction of the target. The "target highlighter" should never leave the camera view however would hover around the "camera edges" to show the general direction of the targeted item.

So.

1. What is the best way to go about this?
2. Is there a function that says "Is object in camera view?"
3. What (if any) function returns the (vector?) extents of the camera view?
4. Anyone else done this? could we see some code?

I suspect that we are making this more difficult than it should be. If you have done something similar we would appreciate any suggestions and advice.
Electron
Posts: 874
Joined: Sun Mar 14, 2004 12:05 am
Location: Massachusetts USA

Post by Electron »

There is a function (ISceneCollisionManager interface) to transform a 3D point into 2D cooridinates. This should solve your problems. If the point is outside screen space an absurdly high 2D coordinate is returned, check the docs for specifics
You do a lot of programming? Really? I try to get some in, but the debugging keeps me pretty busy.

Crucible of Stars
XargoL
Posts: 22
Joined: Sun Aug 01, 2004 7:55 pm

Post by XargoL »

You could also check the source for the ITextSceneNode, which does almost the same thing (displays text on a 3D location).
Post Reply