www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: Irony on May 09, 2015, 12:43:33 pm

Title: [SOLVED] Too dumb to use setorientiation...
Post by: Irony 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?
Title: Re: Too dumb to use setorientiation...
Post by: Irony 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.