I am at present making an attempt to develop my very own little sport engine (making an attempt to grasp maths in video games).
I’ve carried out 4×4 matrices and second vectors (I do not want 3d since I am aiming at orthographic projection in second).
I’ve a Digicam class that has a place and a rotation angle as members.
Each time my digital camera strikes (keyboard enter), I replace its view matrix.
I do it this fashion:
- I translate the digital camera to its place after which create a Z-axis rotation matrix.
- I multiply each and have my view matrix.
All the pieces seems to be effective, and by that I imply that translation works, in addition to rotation and projection is okay too.
However my downside is that objects in my scene don’t rotate across the digital camera place.
It seems to be like my objects rotate round some extent that’s translated by the digital camera too, not like objects rotate across the precise digital camera middle.
And right here is my supply code: https://github.com/yann-kaiser/kyengine
I have no idea if I shall tweak issues in my digital camera transformation or if it is a model-matrix associated factor or anything; may somebody clarify this to me?
EDIT: Lastly discovered the answer. I wanted to first create a translation matrix to the middle of the display (translate by w/2 and h/2), then apply rotation and solely then apply my place translation.



