1. Find an actor's screen position (maybe to draw text over a target, like HudMessageOnActor)
2. Click a screen location to fire a bullet in that direction
3. Determine if a location is in your view
in both opengl and old software render modes. You don't need to know any of the involved maths, and it runs very very fast, too.
Examples included are free aiming (kinda like in Metroid Prime 3), drawing actors' bounding boxes and... a candle with some text over it. Just load the pk3 to test this. Here's an easy example:
Code: Select all
// Setup:
proj.CacheResolution();
proj.CacheFov(players [consoleplayer].fov);
proj.OrientForRenderOverlay(event);
proj.BeginProjection();
// Now you can project as much as you like, just like this:
proj.ProjectWorldPos(mo.vec3offset(0, 0, mo.height));
if(proj.IsInFront()) {
let draw_pos = proj.ProjectToScreen();
Screen.DrawText(
smallfont,
Font.CR_ICE,
draw_pos.x,
draw_pos.y,
"achachachachach");
}
You may do whatever you like with this. There's a lil note in the libeye directory. If you also include that, we're golden.
Feel free to post suggestions, questions about usage, or issues you encountered.