Mtasa-blue: getElementVelocity should return 0,0,0 instead of false

Created on 9 May 2020  路  3Comments  路  Source: multitheftauto/mtasa-blue

Describe the bug
function getElemenetVelocity returns false for some elements types

To reproduce

bin = createObject(1337,2,6,8)
blip = createBlip(1337,2,6,8)

x,y,z = getElementPosition(bin);
vx,vy,vz = getElementVelocity(bin);
iprint("bin",x,y,z,vx,vy,vz) // 2, 6, 8, false, nil, nil

x,y,z = getElementPosition(blip);
vx,vy,vz = getElementVelocity(blip);
iprint("blip",x,y,z,vx,vy,vz) // 2, 6, 8, false, nil, nil

Expected behaviour
Non moving elements such a blips, objects should return 0,0,0

Screenshots
/

Version
MTA:SA Server v1.5.7-release-20447 - server
Multi Theft Auto v1.5.7-release-20447.2 - client

Additional context

iprint("set velocity bin",setElementVelocity(bin, 2,2,2)) -- true
iprint("set velocity blip",setElementVelocity(blip, 2,2,2)) -- false

looks like velocity is supported partially what is confused, you can set velocity of object, but you can't get it back

wontfix

Most helpful comment

I feel like it's reasonable to return false for elements that don't support velocity, to clearly differentiate them from elements that support it but are standing still. What's the benefit of receiving a 0,0,0 instead of false when it's always going to be 0,0,0? If you can't use getElementVelocity for dynamic objects that would probably be a separate issue, most certainly unrelated to this.

All 3 comments

I feel like it's reasonable to return false for elements that don't support velocity, to clearly differentiate them from elements that support it but are standing still. What's the benefit of receiving a 0,0,0 instead of false when it's always going to be 0,0,0? If you can't use getElementVelocity for dynamic objects that would probably be a separate issue, most certainly unrelated to this.

looks like velocity is supported partially what is confused, you can set velocity of object, but you can't get it back

If that means what I think it means, then setElementVelocity returning true on elements that don't support velocity but then getElementVelocity returning false on the very same elements is a bit inconsistent, though. But the example @CrosRoad95 showed before that only calls setElementVelocity on two different types. I'm not sure about what he actually wanted to report as an issue.

What happens if you set the velocity of physics objects?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LosFaul picture LosFaul  路  4Comments

Haxardous picture Haxardous  路  3Comments

CrosRoad95 picture CrosRoad95  路  4Comments

CrosRoad95 picture CrosRoad95  路  3Comments

qaisjp picture qaisjp  路  4Comments