About Store Forum Documentation Contact
Donations:
345$/mo



Post Reply 
Crosshair in 3D
Author Message
DreamsInHD Offline
Member

Post: #1
Crosshair in 3D
Hi,

How do i make a crosshair in a 3D top down shooter? The crosshair is 2D and should be
where the cursor is, while the camera hovers over a player. When i press leftclick
the player should shoot in the direction of the crosshair, but i'm having some trouble showing the crosshair at the position of my cursor since it's 2D and the game in 3D.
Any suggestions?

Thanks in advance.
11-19-2015 08:44 PM
Find all posts by this user Quote this message in a reply
georgatos7 Offline
Member

Post: #2
RE: Crosshair in 3D
You probably want billboarding functionality, so there is the Image method draw3D for simple usage.
Otherwise if you want more control, in Draw() you might wanna do something like...

Code:
Vec myPos = Vec(0, 0, 0);

   ImagePtr loo = UID(609788035, 1305964377, 3078217115, 66910196);
   VI.image(loo());  

   //VI.image(Images(UID(609788035, 1305964377, 3078217115, 66910196)));

   Vtx3DTexCol v[4];
  
   v[0].tex = Vec2(0, 1);
   v[1].tex = Vec2(0, 0);
   v[2].tex = Vec2(1, 0);
   v[3].tex = Vec2(1, 1);            
  
   REPAO(v).color = Color(255, 255, 255, 255);
              
   v[0].pos = myPos;
   v[1].pos = myPos + Vec(0, 1, 0);
   v[2].pos = myPos + Vec(1, 1, 0);
   v[3].pos = myPos + Vec(1, 0, 0);            
  
   VI.alphaTest(false);
   VI.color(Color(255, 255, 255, 255));
   VI.face(v[0], v[1], v[2], v[3]);
   VI.end();

In general search for caps "VI" in the code.
(This post was last modified: 11-20-2015 02:06 AM by georgatos7.)
11-20-2015 02:05 AM
Find all posts by this user Quote this message in a reply
DreamsInHD Offline
Member

Post: #3
RE: Crosshair in 3D
Thanks a lot!
11-20-2015 07:05 AM
Find all posts by this user Quote this message in a reply
Post Reply