Problem with getting coords in front of my vehicle
#4

Take this function from Stepashka. It converts quats to degrees to use.

Quote:
Originally Posted by Stepashka
Посмотреть сообщение
must live simply!!!
PHP код:
stock GetVehicleRotation(vehicleid,&Float:x,&Float:y,&Float:z) {
    new 
Float:quat_w,Float:quat_x,Float:quat_y,Float:quat_z;
    
GetVehicleRotationQuat(vehicleid,quat_w,quat_x,quat_y,quat_z);
    
atan2(2*((quat_x*quat_y)+(quat_w+quat_z)),(quat_w*quat_w)+(quat_x*quat_x)-(quat_y*quat_y)-(quat_z*quat_z));
    
atan2(2*((quat_y*quat_z)+(quat_w*quat_x)),(quat_w*quat_w)-(quat_x*quat_x)-(quat_y*quat_y)+(quat_z*quat_z));
    
asin(-2*((quat_x*quat_z)+(quat_w*quat_y)));
    return 
1;

This will return the x,y,z rotations of the vehicle in degrees. With this you can calculate the rocket's rotation.


Now use one of theses ( again i haven't checked which) in the following code:

PHP код:
Vertical Distance = <Horizontal Distance> * floattan( <W in degrees> , degrees); 
Fill in the < and > parts. And it should return your vertical change in distance.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)