151
Support / Re: About the object "LookAt" , need help
« on: June 10, 2014, 02:20:48 am »
Hello EgonOlsen, I use code like this:
//get the car current position
SimpleVector poscur = car.getTransformedCenter();
//get the car lookat waypoint , the nav point is ahead of car
SimpleVector posLookat = getLookatwaypoint();
posLookat .scalarMul(-1f);
posLookat .add(poscur );
Matrix rotY=posLookat .getRotationMatrix();
car.setRotationMatrix(rotY);
If I change code as follow:
.....
poscur .scalarMul(-1f);
poscur .add(posLookat );
Matrix rotY=poscur .getRotationMatrix();
car.setRotationMatrix(rotY);
the effect is the car 's forward becomes back , please look at the attache picture ,
How can I do ? thank s ~
[attachment deleted by admin]
//get the car current position
SimpleVector poscur = car.getTransformedCenter();
//get the car lookat waypoint , the nav point is ahead of car
SimpleVector posLookat = getLookatwaypoint();
posLookat .scalarMul(-1f);
posLookat .add(poscur );
Matrix rotY=posLookat .getRotationMatrix();
car.setRotationMatrix(rotY);
If I change code as follow:
.....
poscur .scalarMul(-1f);
poscur .add(posLookat );
Matrix rotY=poscur .getRotationMatrix();
car.setRotationMatrix(rotY);
the effect is the car 's forward becomes back , please look at the attache picture ,
How can I do ? thank s ~
[attachment deleted by admin]