About Store Forum Documentation Contact



Post Reply 
Angle
Author Message
djpercy Offline
Member

Post: #1
Angle
Hello,

how do set the angle to a object.

PHP Code:
Matrix mCam=Cameras[cameraID].matrix();
   
mCam.orn().rotateY(Players[0].angle.y);
   
mCam.normalize(); 
   
Cameras[cameraID].matrix(mCam); 

When i do this, my objekts rotate ever.

PHP Code:
Matrix mCam;
   
SetMatrix(matrix());
   
SetMatrix(mCam);
   
mCam=matrix();
   
mCam.orn().setRotateY(pplayer.angle.x);
  
   
mCam.normalize();
   if (
drawMatrix)DrawMatrix();    
   
matrix(mCam); 
wehen i do this i have a wrong Direction

when i set the Direction Down. I have no Rotate whats wrong
PHP Code:
Matrix mCam;
   
SetMatrix(matrix());
   
SetMatrix(mCam);
   
mCam=matrix();
   
mCam.orn().setRotateY(pplayer.angle.x);
   
   
mCam.orn().setOrient(DIRE_DOWN);
   
   
mCam.normalize();
   if (
drawMatrix)DrawMatrix();    
   
matrix(mCam); 

Greeting Denis
(This post was last modified: 12-03-2011 08:01 PM by djpercy.)
12-03-2011 06:45 PM
Find all posts by this user Quote this message in a reply
djpercy Offline
Member

Post: #2
RE: Angle
Hello,

I have the solution but i think is a bug when i write this code failt the rotation in Y.

PHP Code:
Matrix mCam;
   
SetMatrix(mCam);
   
mCam.orn().setRotateY(pplayer.angle.x);   
   
mCam.orn().setRotateX(DegToRad(90.0));
   
mCam.normalize();
  
   
SetMatrix(matrix());
   
matrix(mCam); 

When i write this, it works

PHP Code:
Matrix mCam;
   
SetMatrix(mCam);
   
mCam.orn().setRotateXY(DegToRad(90.0),pplayer.angle.x);
   
mCam.normalize();
  
   
SetMatrix(matrix());
   
matrix(mCam); 

Greetings Denis
(This post was last modified: 12-05-2011 01:21 PM by djpercy.)
12-05-2011 01:20 PM
Find all posts by this user Quote this message in a reply
fatcoder Offline
Member

Post: #3
RE: Angle
All set* methods reset the matrix before appying the transformation. That is why the Y rotation does not work in the first example, but works in the second example. For more details, please read the comments in the header files using the Header Browser tool or in Visual Studio.
12-05-2011 02:14 PM
Find all posts by this user Quote this message in a reply
djpercy Offline
Member

Post: #4
RE: Angle
Hello,

I think not. I have the same Problem without SetMatrix.

Greetings Denis
over the set methode Declaration have found this :-)
// set (set methods reset the full matrix)
ok now i have understand you all set* methode, Thanks
This is my correct solution,TANKS

PHP Code:
SetMatrix(mCam);
   
mCam.orn().setOrient(DIRE_DOWN);
   
mCam.orn().rotateY(pplayer.angle.x);
   
mCam.normalize();
  
   
SetMatrix(matrix());
   
matrix(mCam); 

Greeting Denis
(This post was last modified: 12-05-2011 02:51 PM by djpercy.)
12-05-2011 02:30 PM
Find all posts by this user Quote this message in a reply
Post Reply