Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Copy Object data to Matrix4?

Author
Message
ReElectro
20
Years of Service
User Offline
Joined: 4th Oct 2003
Location:
Posted: 27th Jul 2010 08:31
As I already know that "view matrix4" copies the camera viewing data to the matrix number.

Now how could I do this with copying object's data to a matrix 4?
As I know that each object translation data comes with coordinates, rotation, and scaling via x, y, z.

It's sort of needed project other than the object's 3d coordination on to a 2d screen. As I already know how to do it with On Screen related command.

I ran out of time to type.
I'm not too sure if this is a newbish question or not but I'm still asking it.
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 28th Jul 2010 20:56 Edited at: 28th Jul 2010 20:58
You can recreate the matrix by doing the same thing DBP does for you:

If an object is rotated in the XYZ order, then you:
- rotate X
- rotate Y
- rotate Z
- translate X,Y,Z (T)

so mat = X * Y * Z * T

Like so:


Using the function GetMatrix4(obj), you can obtain the world matrix of that object.

[edit] I forgot the scaling in there, but I don't think it should be that much of a problem. You have to multiply by the scaling matrix:
mat = S * X * Y * Z * T, where S is built using scale matrix4.

Cheers!
Sven B

Login to post a reply

Server time is: 2024-09-28 20:26:25
Your offset time is: 2024-09-28 20:26:25