Public Group

This topic is 2288 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Good afternoon.

I am on a holidays right now, and got a spare week for my own codding fun. Decided to do some 3D programming and i've stumbled upon one problem.

At the moment i am doing a simple task really.
Theres a cube "starting" at X0, Y0, Z0 position and theres "me" at X1, Y1, Z1.

I want to determine if am "targeting" the cube (like Minecraft).

For example:
[WhereIStand]:[-2.1618571][-2.5086415][-2.299999] - My location cordinate
[WhereILook]:[0.7986355][0.60181504][0.52991927] - My view vector (Where i am looking at)
[WhereCubeIs]:[0][0][0] - Cubes location cordinate
[CubeVector]:[1][1][1] - Cubes "Growth" vector

And after this i am stuck.

My problem is that i don't know what to ask of google.

I was thinking about two solutions:
A) Shoot a "missile", it will hit after some time, and i will know if i am "targeting" cube or no. (Kinda retarded idea)
B) 3D Projection into 2D (Get X and Y out of X, Y, Z), no idea how to achieve that. Plus i will dig a grave with it for myself.

This problem is succesfully solved in software like 3D Max or Wings 3D, you can even select a polygon.

##### Share on other sites
Google for "3d picking" Edited by Ashaman73

##### Share on other sites
Picking or ray tracing is what you need to learn from this. Maybe frustum culling as well.

Jerry

1. 1
2. 2
Rutin
20
3. 3
4. 4
A4L
15
5. 5
khawk
14
• ### Forum Statistics

• Total Topics
633737
• Total Posts
3013614
×