Jump to content

Matrices for vehicle components please


AfterAll14

Recommended Posts

Posted

Euler angles given by standart getVehicleComponentRotation are pretty much crazy when you try to sync vehicle components. Given values are difficult to interpolate.We have matrices for elements. So would be nice to have quaternions or matrices for vehicle components as well.

  • 3 weeks later...
  • 2 weeks later...
Posted

Wouldn't that break compatibility to older scripts? It would not be that hard to convert these values to a vector yourself, or to write a function for it that does it automatically for you.

  • MTA Team
Posted
On 12/27/2016 at 1:30 PM, Fierelier said:

Wouldn't that break compatibility to older scripts? It would not be that hard to convert these values to a vector yourself, or to write a function for it that does it automatically for you.

The requirement is that you access it using OOP.

vec = vehicle:getComponentRotation(...)
x, y, z = getVehicleComponentRotation(vehicle, ...)

 

Posted (edited)

@qaisjp Well, actually what I originally meant by this suggestion was something like that:

local matrix = vehicle:getComponentMatrix(..)
vehicle:setComponentMatrix("dummy", matrix)

As I started digging into MTA source by myself, it turned out adding this feature is quite easy. I'm going to include it in this update.

I'm not planning to add vectors for return value for position/rotation, cause as @Fierelier said it could lead to compatibility issues. But if MTA devs think its necessary - so be it :)

update:

took a brief look at wiki - looks like getComponentPosition/getComponentRotation methods are not documented, though they are in the MTA code. So I think that means you can add vectors as return values. Those who used older versions should blame themselves then for using non-documented funcs :P

update 2:

ok, its actually poorly documented in the end xD:

https://wiki.multitheftauto.com/wiki/OOP_client#Vehicle

Edited by AfterAll14
  • 9 months later...
  • MTA Team
Posted

As you might know this was implemented earlier in response to this suggestion, only to be reverted later due to causing script compatibility issues.

Now, in 1.5.5 (latest revision only) it's added back (r11712 onwards)

https://wiki.multitheftauto.com/wiki/Changes_in_1.5.5 > Scripting > Client > ''Return vectors for vehicles component funcs (#9507)"

@AfterAll14 @Einheit-101

Posted

Uhm what exactly changed? The function as it worked before was perfectly fine and I hope I don't have to rework 1000 lines of stuff, because if I want a vehicle componeNt position then ... I want it's position.

  • Like 1
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...