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
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?
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.