AfterAll14

Matrices for vehicle components please

Recommended Posts

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.

Share this post


Link to post

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.

Share this post


Link to post
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, ...)

 

Share this post


Link to post

@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

Share this post


Link to post

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

Share this post


Link to post

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

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.