Quote:
Originally Posted by Pottus
Maybe you have input that could offer some direction that could be taken to improve this function. If update an objects position/rotation while aiming with a weapon and use this function you will see the issue it has.
|
I am not sure what you mean, do you want to align an object with the surface normal of the hit? I don't use ColAndreas, but if that is the case, returning the normal directly would be more practical than Euler angles. If you want to convert that to "some" rotation (there is an infinite number of them that could represent the normal), you can either create that using the product of elementary quaternions (in the correct order), or maybe try this function from my Cinematic Mode:
Код:
stock SetObjectFrontVector(objectid, Float:vx, Float:vy, Float:vz)
{
new Float:r = VectorSize(vx, vy, vz);
new Float:rx = acos(vz/r)+90.0;
new Float:rz = -atan2(vx, vy)+180.0;
SetObjectRot(objectid, rx, 0.0, rz);
}
But it wasn't tested much, to be honest.