Jump to content

  • Log In with Google      Sign In   
  • Create Account


Getting 2d coords from 3d object


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.

  • You cannot reply to this topic
3 replies to this topic

#1 Shawn619   Members   -  Reputation: 342

Like
0Likes
Like

Posted 23 August 2013 - 12:42 PM

Like in tf2, I'm wanting to use the technique of displaying bullet damage in an FPS game by way on 2d text above where the bullet hits the target in 3d like so:

 

2nrhk74.jpg

 

My only problem is that I don't know how to translate this 3d position of where the bullet hit into 2d. Any ideas?



Sponsor:

#2 shazen   Members   -  Reputation: 282

Like
1Likes
Like

Posted 23 August 2013 - 02:35 PM

Most frameworks or libraries have a method to transform a 3dvector.

Vector3 temp = Vector3.Transfom(3dposition, view * projection);
 
Vector2 screenPosition = new Vector2(temp.x, temp.y);


#3 cozzie   Members   -  Reputation: 1552

Like
0Likes
Like

Posted 24 August 2013 - 06:58 AM

You could try to look upsome tutorials on 'picking' (that's the technique your describing).
It is/ can be based on 'shooting a ray' from the camera position through space, and looking which objects/ meshes you're intersecting

#4 Irlan R.   Members   -  Reputation: 1407

Like
0Likes
Like

Posted 23 September 2013 - 08:27 AM

You can use picking + time of impact just as @cozzie described above to estimate the contact point.

A good tutorial: http://www.rastertek.com/dx11tut47.html


Edited by irlanrobson, 23 September 2013 - 08:27 AM.





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.



PARTNERS