[T2] Internal Function Rounding Error

Dr.Spangle
09-01-2004, 12:50 PM
// Causing highly accurate weapons to only be non 0 occasionally.
%mat = MatrixCreateFromEuler(%x* 10 @ " " @ %y*10 @ " " @ %z*10);
%vector = MatrixMulVector(%mat2, %vector);

As the title of this thread implies, I appear to be running into some kind of rounding error in the function MatrixCreateFromEuler(). What I am attempting to do is create a sniper rifle which is highly accurate, but not COMPLETELY 100% accurate. From what I can tell, I need a "matrix" type object to turn into a "vector" object in order to spawn the projectile that I want to use. Whenever I do this, however, I'm getting perfectly accurate projectiles.

Suggestions? Did I not explain myself well enough? Please, let me know.

Dr.Spangle
09-05-2004, 08:35 PM
Bump attempt #1.

bad_billy
09-05-2004, 10:52 PM
t2 sucks!

Silverspirit
09-06-2004, 12:15 AM
I don't know what MatrixCreateFromEuler or MatrixMulVector do, but what I would do is just add a random vector to your original one.

Something like:

%vector = VectorScale(VectorNormali ze(%playerMuzzleDirection ), 100);
%vector = VectorAdd(VectorNormalize (random() SPC random() SPC random()), %vector);


I think that would give the direction a variation of 0% to 1%.

I don't remember how to get random numbers or if VectorNormalize is the correct function name, but assume random() gets a number from -x to x.