My 3D Hero-Model is positioned at a certain point in 3D-Coordinates. Whenever he's colliding with a coin, I want to place an animated sprite sheet there. But my following implementation won't give me useful result.
Viewport vP = GraphicDevice.Viewport; Vector3 unitPos = modelPos.LocalPosition; Vector3 screenSpace = vP.Project(unitPos, _cam.Projection, _cam.View, Matrix.Identity); MySprite sprite = new MySprite(unitPos.X, unitPos.Y); //... Won't draw sprite where the model is The sprites are almost at the exact position, but there's approx. a 100px difference. I am using a perspective camera with these settings:
Matrix Projection = Matrix.CreatePerspectiveFieldOfView((float)Math.PI / 3.0f, 800f / 480f, 1, 3000); And when I place my camera to Z= 0 Y = 37 and Z = 220, I have to multiply the result of Vector3 by 3.
The position of my camera is a Vector3 though.
A is the pure calculated value for SpriteY and B is the calculated value *3 (coincidentally is the right position)

So, it isn't correct. Why???


MySpriteconstructor do anything non-standard with its inputs? 2D coordinates start from the upper-left corner, which might account for your inverted y coordinate. \$\endgroup\$