Burgershot
  • Home
  • Members
  • Team
  • Help
  • Search
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search
Burgershot open.mp Questions and Suggestions [Question] Vehicle rotation | help with this?

 
  • 0 Vote(s) - 0 Average
Question Vehicle rotation | help with this?
Leonardo
Offline

Burgershot Member
Posts: 17
Threads: 5
Joined: Nov 2020
Reputation: 3
#1
2021-01-26, 01:05 PM
[Image: vrot.jpg]

I was wondering if you need help with this, because it might help.

What I have done has been a function to obtain the euler rotation from a matrix.

In the unoccupied sync, the SA-MP client sends the right and front vectors to the server, so it is necessary to build the up vector to obtain the euler rotation, so I also made a function for that.

To test it, I converted the C ++ code to Pawn, this would be the result:

[Video: https://youtu.be/_sBAISz_JMo]

00:00 incar testing
00:20 unoccupied testing

[Video: https://youtu.be/3mZZsGd-g0M]

00:00 airplane testing

Part of the Pawn code would look like this:

Code:
forward test_timer();
public test_timer()
{
    if(test_vehicleid != INVALID_VEHICLE_ID)
    {
        new mat[MATRIX];
        new pos[VECTOR];
        new rot[VECTOR];
       
        mat = GetVehicleMatrix(test_vehicleid);
        rot = Matrix_GetRotation(mat, Vector(-9999.0, -9999.0, -9999.0));
        pos = Matrix_Multiply3x3(mat, Vector(0.0, 12.0, 2.0));
       
        pos[X] += mat[POS][X];
        pos[Y] += mat[POS][Y];
        pos[Z] += mat[POS][Z];
       
        SetObjectPos(test_objectid, pos[X], pos[Y], pos[Z]);
        SetObjectRot(test_objectid, rot[X], rot[Y], rot[Z]);
    }
}

I would not know who to talk to to discuss this issue, so I created this post. If you are interested in this, you can send me a private and I will send you the source code in C ++, including the Pawn code.

Note: Sorry for my English, I speak Spanish and I have translated this with google translate.
« Next Oldest | Next Newest »



Messages In This Thread
Vehicle rotation | help with this? - by Leonardo - 2021-01-26, 01:05 PM
RE: Vehicle rotation | help with this? - by Freaksken - 2021-01-26, 04:51 PM
RE: Vehicle rotation | help with this? - by IllidanS4 - 2021-01-26, 04:53 PM
RE: Vehicle rotation | help with this? - by Freaksken - 2021-01-27, 02:31 PM
RE: Vehicle rotation | help with this? - by Leonardo - 2021-01-27, 02:53 PM
RE: Vehicle rotation | help with this? - by IllidanS4 - 2021-01-27, 03:13 PM

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Burgershot - Powered by our Community and MyBB Original Theme by Emerald

Linear Mode
Threaded Mode