DirectX 11 Matrices

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
LPS_MAN
Posts: 21
Joined: September 19th, 2013, 7:23 pm

DirectX 11 Matrices

Post by LPS_MAN » February 1st, 2014, 5:01 pm

How can you check in 3D programming to see if one matrix is equal to another for example I have a box that moves about on the screen and, like 2d pong, I want to check if it is at the edge of the screen. Please help.

MrGodin
Posts: 721
Joined: November 30th, 2013, 7:40 pm
Location: Merville, British Columbia Canada

Re: DirectX 11 Matrices

Post by MrGodin » February 1st, 2014, 5:22 pm

I suppose what you can do is make the camera stationary then set a binding box if you will. Constrain movement in the world space to be relative to the screen
eg D3DXVECTOR3 Min = -10,-10,0, D3DXVECTOR3 Max = 10, 10,0. zero on the z since you just want side to side movement. Then you set your Velocity as you would in 2d to change directions when x < -10 or x > 10 for instance. problem is, if someones screen is larger or smaller (if in full screen mode)... You'd have to get the back buffer desc and find out the screen size then adjust your constraining box to fix relative to the screen. Not sure if this helps, but i just pulled it off the top of my head lol.
Curiosity killed the cat, satisfaction brought him back

User avatar
LuisR14
Posts: 1248
Joined: May 23rd, 2013, 3:52 pm
Location: USA
Contact:

Re: DirectX 11 Matrices

Post by LuisR14 » February 2nd, 2014, 2:23 am

for checking if one D3DXMATRIX is equal another there's the == operator :P
always available, always on, about ~10 years c/c++, java[script], win32/directx api, [x]html/css/php/some asp/sql experience. (all self taught)
Knows English, Spanish and Japanese.
[url=irc://irc.freenode.net/#pchili]irc://irc.freenode.net/#pchili[/url] [url=irc://luisr14.no-ip.org/#pchili]alt[/url] -- join up if ever want real-time help or to just chat :mrgreen: --

LPS_MAN
Posts: 21
Joined: September 19th, 2013, 7:23 pm

Re: DirectX 11 Matrices

Post by LPS_MAN » February 2nd, 2014, 4:14 pm

how would this look in the code then

LPS_MAN
Posts: 21
Joined: September 19th, 2013, 7:23 pm

Re: DirectX 11 Matrices

Post by LPS_MAN » February 2nd, 2014, 4:16 pm

I should probably explain further, if the box offset matrix is equal to the edge of the playing field matrix X where X is a position I want the box to not move any further even when A or D is pressed.

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: DirectX 11 Matrices

Post by albinopapa » February 2nd, 2014, 7:00 pm

I think I would decide whether I wanted a top-down view, using or side view, set the camera and make the boundaries of the world fit inside the viewport. Then I would just need to compare X and Z positions of box to X and Z boundaries for a top-down view or X and Y box and boundaries in a side view. Basically, the logic I would assume would be the same as 2D checks instead of checking if the matrices are the same...matrix of the box probably will never be the SAME as the matrix of the boundaries of the world.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

Post Reply