Firing problem in space sim
Having problems again with the laser firing code.
I think what I need to do is take the look vector some distance out in front of the ship and subtract it from the position of the weapon to get the right vector.
Code:
D3DXVECTOR3 Target=Camera.Look;
//Range of weapon
Target.z+=(Camera.Look.z*20.0f);
D3DXVECTOR FromWeaponToTarget;
FromWeaponToTarget=Target-Weapon.Position;
D3DXVec3Normalize(&FromWeaponToTarget,&FromWeaponToTarget);
But how do I rotate the model so that it is always facing the direction it is firing?