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?
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?
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?