Jump to content

World to screen logic


aloha087

Recommended Posts

Hey, I am trying to make an external overlay for Minecraft (proof-of-concept).

I want to make external block overlays in C++ rendered over the top of the game. In order to do this for a target block, I need the screen locations of the 4 block corner point positions in the player's view in XY format.

This position depends on multiple factors including Player Location, Yaw, Pitch, FOV, Monitor Resolution and whether the game is being played in Full Screen or Windowed mode.

It would be great to find a solution - the game is always played in full screen and the monitor resolution is 1920x1080

Can anybody help me with this and show me how I would go about doing it?

Thanks,

aloha087

 

Edited by aloha087
Link to comment
Share on other sites

What does this have to do with forge?

"This is the support section for those modding with Forge"

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

13 minutes ago, warjort said:

What does this have to do with forge?

"This is the support section for those modding with Forge"

The screen locations will be sent to the external overlay via a Forge mod. Forge would be ideal for getting positions also.

Link to comment
Share on other sites

 Forge doesn't haven't an api for this. Minecraft itself never really has this information.

You can find a similar question asked (except in reverse) here: https://forums.minecraftforge.net/topic/114283-119-screen-point-xy-to-world-coordinates-xyz

In simplistic terms Minecraft does its world rendering in "world coordinates" only later after it has worked out what should be displayed does it translate it to "screen coordinates".

And what is translated at that point has long since lost its connection to the block abstraction.

 

The assumption that blocks are in some sense cubic or even confined to a 1x1x1 cube is also incorrect.

Try looking a lectern and pay attention to the shape and extent of its hitbox. 🙂 

 

Finally, directly using the opengl java api (instead of Minecraft's rendering api) is strongly discouraged. Calling native code to do it is pretty much the same thing, if not worse.

 

Edited by warjort

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.