Dynamic Vertex Orientation Q
Blitz3D Forums/Blitz3D Programming/Dynamic Vertex Orientation Q
| ||
Ola ppl. it has been ages since I fiddled with some proper b3d stuff, causing me to forget half of how it's done :\ Problem here is this. I've got a load of particles in a single-surface particle system. The partcles consist of single- or double sided quads or triangles, depending on the settings specified. What I want to do is orient the particles in such a way that they always face the camera, nomatter where they are located or oriented. So basicly I need to align the front of such a particle to the camera view. Remember though, that these particles are not seperate entities, but they merely consist of vertex coordinates and indices within the emitter mesh. Any help with this would be very much appreciated. |
| ||
Well, what some ppl do is use t-form commands. I don't really understand how that works so.... i use sin and cos :) Check your mail btw. The way i've done it is pretty messy, but i beleive it is fast. Make all quads face the camera :) The part of the source that does the rotation is... VertexCoords(fire_surface,fire\pindex+0,fire\x+Sin(fire\ang)*fire\size,fire\y+Cos(fire\ang)*fire\size,fire\z) VertexCoords(fire_surface,fire\pindex+1,fire\x+Sin(fire\ang+90)*fire\size,fire\y+Cos(fire\ang+90)*fire\size,fire\z) VertexCoords(fire_surface,fire\pindex+2,fire\x+Sin(fire\ang-90)*fire\size,fire\y+Cos(fire\ang-90)*fire\size,fire\z) VertexCoords(fire_surface,fire\pindex+3,fire\x+Sin(fire\ang+180)*fire\size,fire\y+Cos(fire\ang+180)*fire\size,fire\z) fire_xdist(0)=Sin(fire\ang)*fire\size fire_xdist(1)=Sin(fire\ang+90)*fire\size fire_xdist(2)=Sin(fire\ang-90)*fire\size fire_xdist(3)=Sin(fire\ang+180)*fire\size fire_ycoord(0)=Cos(fire\ang)*fire\size fire_ycoord(1)=Cos(fire\ang+90)*fire\size fire_ycoord(2)=Cos(fire\ang-90)*fire\size fire_ycoord(3)=Cos(fire\ang+180)*fire\size For loop=0 To 3 VertexCoords(fire_surface,fire\pindex+loop ,fire_xdist(loop), fire\y+fire_ycoord(loop)*Cos(cam_rot_x) ,fire\z+Sin(cam_rot_x)*fire_ycoord(loop) ) Next fire_zdist(0)=Sin(cam_rot_x)*fire_ycoord(0) fire_zdist(1)=Sin(cam_rot_x)*fire_ycoord(1) fire_zdist(2)=Sin(cam_rot_x)*fire_ycoord(2) fire_zdist(3)=Sin(cam_rot_x)*fire_ycoord(3) fire_ycoord(0)=fire_ycoord(0)*Cos(cam_rot_x) fire_ycoord(1)=fire_ycoord(1)*Cos(cam_rot_x) fire_ycoord(2)=fire_ycoord(2)*Cos(cam_rot_x) fire_ycoord(3)=fire_ycoord(3)*Cos(cam_rot_x) For loop=0 To 3 VertexCoords(fire_surface,fire\pindex+loop ,fire\x+ (fire_xdist(loop)*Sin(cam_rot_y)) - (fire_zdist(loop)*Cos(cam_rot_y)), fire\y+fire_ycoord(loop) ,fire\z+(fire_zdist(loop)*Sin(cam_rot_y)) - (fire_xdist(loop)*-Cos(cam_rot_y)) ) Next |
| ||
Um... could you give me your e-mail address? Or mail me your e-mail address :) |