Matrix idea might work. (iv used matrix's b4 for Tiberian Sun's/Red Alert 2's HVA's, HVA stands for homogeneous voxel animation or something like it, basicaly the frames are homogeneous matrix's)
EDIT: Matrix worked thx for the idea.
Code: Function GetRandomParticleStartPos(Radius,XAngle,YAngle : Extended) : TVector3f; Const Multi = 1000; // Higher this is the more accurate the positions can be var Pos : TVector3f; Matrix : TMatrix; X,Y : Integer; begin Pos.X := (Random(Trunc(Radius*Multi))/Multi)-(Random(Trunc(Radius*Multi))/Multi); Pos.Z := (Random(Trunc(Radius*Multi))/Multi)-(Random(Trunc(Radius*Multi))/Multi); Pos.Y := 1; For x := 0 to 3 do For y := 0 to 3 do Matrix[x,y] := 0; Matrix[0,0] := 1; Matrix[1,1] := 1; Matrix[2,2] := 1; Matrix[3,3] := 1; //Matrix := Turn(Matrix,XAngle); //Matrix := Pitch(Matrix,XAngle); //Matrix := Roll(Matrix,DegToRad(YAngle)); Matrix := Pitch(Matrix,DegToRad(YAngle+90)); Matrix := Turn(Matrix,DegToRad(XAngle)); Result.X := Pos.X * Matrix[0,0] + Pos.Y * Matrix[0,1] + Pos.Z * Matrix[0,2] + Matrix[0,3]; Result.Y := Pos.X * Matrix[1,0] + Pos.Y * Matrix[1,1] + Pos.Z * Matrix[1,2] + Matrix[1,3]; Result.Z := Pos.X * Matrix[2,0] + Pos.Y * Matrix[2,1] + Pos.Z * Matrix[2,2] + Matrix[2,3]; end;
Ill post the full code for the unit once iv finished it + made some particle scripts.
|