Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6821

[Solved]Aligning the spriteBatch to the 3D Projection/View

$
0
0

@edenprojectde wrote:

I'm trying to draw graphs onto some sprites.
So i want to align the 3D Camera of SpriteBatch and the 3D Camera of my Graphs to be the same but i dont get it to work i tried it another time before and searched the web and some threads on this forum for information but something was always missing and i dont understand till this day how to do this.

So what i want is that Vector3(x,y,0)==Vector2(x,y) on screen.

I tried these methods:
pastebin.com/H9cQwN20
...[List goes on with stuff that didnt work out]

Maybe any other solutions?

My current Code:
pastebin.com/cn79PCUn

The important part:

var cameraPosition = new Vector3(350, 350, 350);
var cameraLookAtVector = new Vector3(350, 350, 0);
var cameraUpVector = Vector3.UnitZ;

basicEffect.View = Matrix.CreateLookAt(
                cameraPosition, cameraLookAtVector, cameraUpVector);

basicEffect.Projection = Matrix.CreateOrthographicOffCenter(new Rectangle(0, 0, 700, 700), 0.1f, 1000);

My screen size in the project is currently 700x700

Posts: 5

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles