Jump to content

Recommended Posts

Posted (edited)

I'm trying to project a 3D point to 2D to have sprites follow a model around in an SDK project based on the 3D demo. However, when I try to apply the code I get online to do so, nothing happens. When I print the values on screen, they're all over the place!

Here's my code.

xpos = cammatrix.xrite * crosshair.transform.xpos + cammatrix.yrite * crosshair.transform.ypos + cammatrix.zrite * crosshair.transform.zpos;

ypos = cammatrix.xdown * crosshair.transform.xpos + cammatrix.ydown * crosshair.transform.ypos + cammatrix.zdown * crosshair.transform.zpos;

screen_x_pos = ((long)xpos + CAMWIDTH) >> 14;
screen_y_pos = ((long)ypos + CAMHEIGHT) >> 14;
buf1_olist[1].bit.xpos = screen_x_pos;
buf2_olist[1].bit.xpos = screen_x_pos;
buf1_olist[1].bit.ypos = screen_y_pos;
buf2_olist[1].bit.ypos = screen_y_pos;
OLbldto(drawbuf ? buf2_olist : buf1_olist, drawbuf ? packed_olist2 : packed_olist1);

(CAMWIDTH is 320, CAMHEIGHT is 240)

I've been told that loadxpt.inc has code to do what I'm looking for. Does anyone here know how to get to that?

What do I do?

Edited by Cobradile

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...