[Question] Vehicle rotation | help with this? - Printable Version + open.mp forum (https://forum.open.mp) -- Forum: open.mp (https://forum.open.mp/forumdisplay.php?fid=40) --- Forum: Questions and Suggestions (https://forum.open.mp/forumdisplay.php?fid=42) --- Thread: [Question] Vehicle rotation | help with this? (/showthread.php?tid=1596) |
Vehicle rotation | help with this? - Leonardo - 2021-01-26 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(); 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. RE: Vehicle rotation | help with this? - Freaksken - 2021-01-26 You might want to have a look at this: https://github.com/IllidanS4/i_quat RE: Vehicle rotation | help with this? - IllidanS4 - 2021-01-26 No need for that, we are already provisioned just fine. It does seem to be describing everything i_quat does and can offer. RE: Vehicle rotation | help with this? - Freaksken - 2021-01-27 We appreciate the effort to try to help and contribute though. RE: Vehicle rotation | help with this? - Leonardo - 2021-01-27 They are absolutely right. The truth is that he had been out of SA-MP for like 5 years and had no idea of the existence of that include. I have checked the results of both methods, comparing them with AttachObjectToVehicle, and they both seem to have the same result. https://youtu.be/vSZyMilgcuU But I have to say one thing in favor of i_quat, is that it is more efficient, and requires less calculations. Even building the up vector is 1000 times faster. What I had done was to obtain 2 times the rotation, one with up.z = 1.0 and another with up.z = -1.0, then compare which of the two results is equal to the right and front vectors. The difference is brutal. Anyway, I'm going to post the include, in case it can help someone to have these matrix functions in Pawn. Once again, Sorry for my English. RE: Vehicle rotation | help with this? - IllidanS4 - 2021-01-27 It is quite impressive if you managed to find a solution to this problem on your own anyway; too bad you didn't release it 5 years ago ;-) Good job anyway! |