Code: Select all
if(this.ship.missiles && ((this.ship.missiles.length / 2) === Math.floor(this.ship.missiles.length / 2))
{missile.position.x = missile.position.x - 20;}
else
{missile.position.x = missile.position.x + 20;}
One thing to remember if you're looking at positioning them to a specific point on the ship is that the position on the ship is local (the origin is the centre of the ship, or wherever you put it on the model) and for the launched missile it will be universal (the origin is the witchpoint). You may need to do a "local to global" conversion, such as the one in the griff sub-ent cobra script.
But in the above case that won't matter as you're just moving the missile relative to its current position. I just include the comment for completeness.[/color]