• Create Account

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

2 replies to this topic

#1Sollum  Members

1090
Like
0Likes
Like

Posted 10 September 2012 - 06:13 AM

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.

#2Ashaman73  Members

13649
Like
2Likes
Like

Posted 10 September 2012 - 06:23 AM

Edited by Ashaman73, 10 September 2012 - 06:23 AM.

Ashaman

#3monkeyboi  Members

188
Like
0Likes
Like

Posted 10 September 2012 - 02:42 PM

Picking or ray tracing is what you need to learn from this. Maybe frustum culling as well.

Jerry

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.