how can it get camera direction as a unit vector? any equations, formulas?
does it have to do with player's position and pointed thing's position?
Hybrid Dog wrote:Can I somehow get the exact pointed position instead of the position of the node, which is pointed? I think the paintings mod does this, but when l read its code a few months ago, l didn't know scalar products (or dot products?) yet, which might be necessary for this.
ArguablySane wrote:Hybrid Dog wrote:Can I somehow get the exact pointed position instead of the position of the node, which is pointed? I think the paintings mod does this, but when l read its code a few months ago, l didn't know scalar products (or dot products?) yet, which might be necessary for this.
I don't think there's any built-in function to do this, but I could be wrong.
To do it manually, you need to look up how to find the intersection between a vector and a plane. Then you assume that the looked-at node is a cube and calculate intersections with all 6 faces. The exact pointed position is the intersection point closest to the player which doesn't lie outside the cube. It's a bit tricky, but mostly just involves lots of vector algebra.
If you want to work with non-cubic nodes, then the entire thing gets a lot more complicated and I wouldn't even know where to begin.
Users browsing this forum: No registered users and 3 guests