Author Topic: [SOLVED] Too dumb to use setorientiation...  (Read 2107 times)

Offline Irony

  • long
  • ***
  • Posts: 151
    • View Profile
[SOLVED] Too dumb to use setorientiation...
« on: May 09, 2015, 12:43:33 pm »
I want a shot to point towards a certain target but it points in some strange direction.
Do you see any obvious flaw in my code?

Code: [Select]
vTargetPos.sub(vPlayerPos);  //to get direction vector
vTargetPos.normalize(vTargetPos);
vUp.set(vTargetPos.calcCross(VECTOR_LEFT));   // I do not care about the up vector, so I calculate an abitrary one
shot.setOrientation(vTargetPos, vUp);

As said, this does not work at all. Don't ask how I managed to finish my space shooter without figuring basic stuff like this out   ::)
btw: "Direction" in setorientation means positive z-axis - right?
« Last Edit: May 09, 2015, 02:10:28 pm by Irony »

Offline Irony

  • long
  • ***
  • Posts: 151
    • View Profile
Re: Too dumb to use setorientiation...
« Reply #1 on: May 09, 2015, 12:57:44 pm »
Ok, I think I got it. The problem was that I - for a reason I do not remember - have always used the xAxis as "forward" in my game. So, the models are oriented in the wrong way for setorientation. I am changing this for the blasts.