Author Topic: How to set a matrix x angle to zero ?  (Read 855 times)

Offline gamenewer

  • long
  • ***
  • Posts: 171
    • View Profile
How to set a matrix x angle to zero ?
« on: October 20, 2014, 11:19:10 am »
Maybe this question is very simple,  but i  don't know how to do so , forgive me

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: How to set a matrix x angle to zero ?
« Reply #1 on: October 20, 2014, 11:23:55 am »
I don't get the question... ???

Offline gamenewer

  • long
  • ***
  • Posts: 171
    • View Profile
Re: How to set a matrix x angle to zero ?
« Reply #2 on: October 20, 2014, 11:41:19 am »
I get a matrix  from a vector , I only want to rotate my car by  Y and Z , so I must  set the X angle to 0 , but  I don't know how to set  x angle to 0
« Last Edit: October 20, 2014, 11:50:23 am by gamenewer »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: How to set a matrix x angle to zero ?
« Reply #3 on: October 20, 2014, 12:25:51 pm »
By setting the x-component of the vector to 0 in the first place?

Offline gamenewer

  • long
  • ***
  • Posts: 171
    • View Profile
Re: How to set a matrix x angle to zero ?
« Reply #4 on: October 20, 2014, 01:57:06 pm »
Wow,  I perform an  lookat action,  I get the SimpleVector from a curve , and   get this SimpleVector matrix , then set the car by this matrix ,

                        SimpleVector posAhead = way.PointOnPath(xp);   
         SimpleVector poscur = getTransformedCenter();
         posAhead.sub(poscur);
         rotMatrix=posAhead.getRotationMatrix();

                        //here    must set  X angle to 0
                        ???? setXangle = 0 ???
                        //
                        setRotationMatrix(rotMatrix);

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: How to set a matrix x angle to zero ?
« Reply #5 on: October 20, 2014, 02:06:43 pm »
posAhead.x=0!?

Offline gamenewer

  • long
  • ***
  • Posts: 171
    • View Profile
Re: How to set a matrix x angle to zero ?
« Reply #6 on: October 20, 2014, 02:09:13 pm »
if  I  set  posAhead.x=0  , the car will rotate  very strange  and not perform a lookat action,  So it's not right
« Last Edit: October 20, 2014, 02:15:53 pm by gamenewer »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: How to set a matrix x angle to zero ?
« Reply #7 on: October 20, 2014, 02:25:02 pm »
My bad...i actually meant to 0 y, not x.

Offline gamenewer

  • long
  • ***
  • Posts: 171
    • View Profile
Re: How to set a matrix x angle to zero ?
« Reply #8 on: October 20, 2014, 02:33:20 pm »
You are greate !    set Y  = 0  it's OK ! :)