-
Active Member
VIewMatrix for WorldToScreen
Hi,
Anyone found the pointer for the viewmatrix? - I struggle finding the pointer and the information about the ViewMatrix so I can create WorldToScreen.
Any idea on how to find it?
Was much easier in WoW where you could spin the camera around
-
Contributor
-
Active Member
Originally Posted by
ejt
Isometric view...
See I would lie if I said that makes any sense for me 
Beside just knowing that 1 tile in D2 should be 15 px, i would like to get that from the game, without hardcoding it - If possible.
Also I have been trying to find the zoom scale, havent been able to do that.
Might have another name then "ViewMatrix"
-
Contributor
Originally Posted by
NoxiaZ
Might have another name then "ViewMatrix"
Yes, isometric projection, or isometric view.
-
Active Member
Ah okay, thanks ill remember that
Do you have any information about where or how i can find it ?
-
Active Member
I seem to have figured it out, without using any memory information.
I came up with this code:
Code:
public Vector2 WorldToScreen(Size windowSize, Vector2 playerLocation, Vector2 targetLocation)
{
var tileToPxSize = 15;
var height = windowSize.Height;
var width = windowSize.Width;
var center = new Vector2(width / 2, height / 2);
var subtract = Vector2.Subtract(playerLocation, targetLocation);
subtract = Vector2.Transform(subtract, Matrix3x2.CreateRotation(45));
var data = new Vector2(subtract.X * -tileToPxSize, subtract.Y * -tileToPxSize);
var data1 = Vector2.Add(center, data);
return data1;
}
-
Post Thanks / Like - 1 Thanks
prrovoss (1 members gave Thanks to NoxiaZ for this useful post)