As the description mentioned I have all the coding I need for the ships functions: quaternions, textures, ray casting for collision checking, I even have the beam being drawn in the right direction the ship is facing. I just need to get the beam, drawn in the form of a 2d sprite with no rotation except the rotation of the ship right now, to face the camera so that the beam looks like a beam and not a flat sprite. (rotation around the x axis)
camera variables:
x,y,z -> global.fromx,global.fromy,global.fromz
Draw event code I have now for the replicated frigate:
//turn off lighting and culling for the sprite drawing
d3d_set_lighting(false);
d3d_set_culling(false);
if (firing)
{
d3d_transform_set_identity();
d3d_add_rotation_quaternion(Qw,Qx,Qy,Qz);//point in the same direction as the quaternion
//d3d_transform_add_rotation_x(beam rotation script goes here returning the right value);
d3d_transform_add_translation(x+FVx*10,y+FVy*10,z+FVz*10)//move the start of the beam to the front of the ship
draw_sprite_ext(tex_IonCannonBeam,0,0,0,beam_distance,.05,0,c_white,1);// draw the actual beam
d3d_transform_set_identity();
}
d3d_set_lighting(true);
d3d_set_culling(true);
if (point_distance3d(x, y, z, global.fromx, global.fromy, global.fromz) < visible_range)
{
d3d_add_rotation_quaternion(Qw,Qx,Qy,Qz);
d3d_transform_add_translation(x,y,z);
d3d_model_draw(global.TS_IonCannonFrig_model,0,0,0,global.tex_ship_tex);
d3d_transform_set_identity();
}
I don't know the math I would need to find the value and I have looked everywhere.
EXAMPLE IMAGE:
http://media.photobucket.com/image/ion%20cannon%20homeworld/DrunkenGrognard/homeworld-1.jpg
Edited by sharpe_alex10@yahoo.com, 20 February 2012 - 10:38 PM.











