Jump to content

Recommended Posts

the closest I know is "input.lua"s screen-to-world method:

self.entitiesundermouse = TheSim:GetEntitiesAtScreenPoint(TheSim:GetPosition())

Unfortunately I couldn't find a way to reverse this. And by "reverse this" I mean a similiarly called function.

You can fetch the resolution like this:

--Returns the resolution of the game display. Information only valid in fullscreen.
function GetResolution()
	local go = TheFrontEnd:GetGraphicsOptions() --Keep in mind that if you are running this in the special 'modmain.lua'/'modworldgenmain.lua' environment, it must be GLOBAL.TheFrontEnd
	local id = go:GetFullscreenDisplayID()
	local mode_id = go:GetCurrentDisplayModeID(id)
	return go:GetDisplayMode(id, mode_id)
end

You may be able to derive the screen position based on that and the player's coordinates.

5 hours ago, Arkathorn said:

You can fetch the resolution like this:

You may be able to derive the screen position based on that and the player's coordinates.

You'd need to keep the camera angle in mind. Luckily, "TheCamera" has functions to retrieve its current Vectors.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...