• Advertisement
Sign in to follow this  

Position 3D mesh in 2D tile based map, need help!

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have matView2D and matProj2D to render the tile based map, and I have different matView3D and matProj3D to render mesh characters. For example, to place my character in (400, 300) screen coordinates, I need to translate this 2D offset to 3D offset and I thought matWorld2D * matView2D * matProj2D = matWorld3D * matView3D * matProj3D matOffset = matView2D * matProj2D * Inverse(matProj3D)* Inverse(matView3D) Now every time I have a 2D translation matTranslate2D matTranslate3D = matTranslate2D * matOffset Then I use matWorld3D = matScale3D * matRotate3D * matTranslate3D to move my character. But, this doesn`t work. ?????????????????????????????????

Share this post


Link to post
Share on other sites
Advertisement
Two things to try.

1. Use an orthographic projection, and draw your meshes and "terrain" (read: tiles) in the same model-space.

2. Draw your terrain, and render your meshes to an off-screen buffer. Project the origin of your mesh into 2D space to find the "origin" of the off-screen buffer, and then blit the off-screen image to the screen at the correct location.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement