[SOLVED] 3d view mouse drag direction

I am still in the early stages of writing a 3d game in monogame, and this is also my first attempt at 3d.
I have a 3d model representing a playing card that I am dragging with the mouse. When the card is face down and I drag, it moves in the correct direction i.e. direction of the mouse.

The problem is, when I rotate the card to be face up and then drag, it moves in the opposite direction to where I want to go. This only occurs along the X axis (dragging left or right). It moves in the right direction on the Y Axis (dragging up or down). I am maintaining the same Z when dragging.

I am not sure what the math is for getting it moving in the right direction in the X axis. Any pointers on how I can get this to work?

Thanks!

The “world” of the card has changed after the rotation. How do you do your rotation ?
Look here for explanations maybe: http://rbwhitaker.wikidot.com/basic-matrices

Thanks for the response. I rotate the card by setting the model’s rotation to 180 degrees and recalculating the world matrix for the card i.e. SRT multiplication

Am I missing something? Should I be doing the calculation in a different way?

In 3d, the order of the operations are not commutative, ie the order matters.
A rotations and a translation is not the same as a translation and a rotation.

You rotate around which axis ? Do you have some code to show ?

Ugh… for some reason it appears that my matrix calculation was actually in STR order and not SRT… I kept reading it as SRT though :slightly_smiling:

Now that I corrected it, things seem to be working as expected. Thanks for the help!

Glad to help.
If you could mark the subject as [SOLVED] :wink: