FCNPC icon indicating copy to clipboard operation
FCNPC copied to clipboard

Vehicle velocity bug

Open ziggi opened this issue 8 years ago • 6 comments

http://forum.sa-mp.com/showthread.php?p=3892445#post3892445

Use what DRIFT_HUNTER suggested, then GoTo and then SetQuaternion (setangle must be false in GoTo).

The vehicle sync is still bad with GoTo, mainly because the velocity is still wrong (when using GoTo at least) and we cannot set angular velocity (which is needed for > non-abrupt turns).

Theoretically it works best by only using GiveVelocity and SetQuaternion. Using that gives a result really close to regular NPCs (no warps, ramming works fine etc) but it > is very hard to control (the script has to check positions and calculate each movement by the offset from the velocity and do a lot of calculations, and it's not path > based).

Edit: This is the warping that I mentioned. The steeper the angle, the more often the NPC warps/teleports. Only happens client side. It also doesn't matter if the Vehicle > is correctly rotated or touching the ground. It always happens, to planes/bikes as well. It looks like for each meter it travels vertically, it skips some of that distance, probably due to wrong (z) velocity. https://www.youtube.com/watch?v=aqDerTWje8g

I can also upload a video which nicely shows the difference between using Velocity and GoTo. It would be nice if Ziggy could look into that and try to make GoTo work as well as Give/SetVelocity does

ziggi avatar Jun 28 '17 17:06 ziggi

Would it help you if I post here some code to easily reproduce? I also wrote a small script that perfectly shows the difference between GoTo and using Velocity (it also measures what speed value is equivalent to a given Velocity - maybe that could help getting the right values in GoTo).

Naseband avatar Jun 28 '17 18:06 Naseband

Of course, it would be nice.

ziggi avatar Jun 29 '17 03:06 ziggi

Im guessing these should wait for 2.0 and partial recordings/offsets. When we get that maybe we will be able to analyze best velocity/speed combination by actually recording and checking data we recorded, these specially goes for angular velocity since it is damn hell to calculate.

BitFros7y avatar Jun 30 '17 20:06 BitFros7y

I don't think it is that complicated to adjust the Velocity (with that I mean that analyzing rec data shouldn't be needed for that).

Here's a Test Script which shows the Velocity difference of GoTo and SetVelocity by moving 2 NPCs at the same speed, one with GoTo, one with SetVelocity:

Speed Test If you run it, it will print some comparison data of both NPCs (Distance, Speed in m/s and Velocity).

The Velocity of the GoTo NPC is 1/100th of the GoTo Speed. Which is definitely wrong.

Currently, 0.1 Speed in GoTo equals 1 m/s, and 0.02515 Velocity equals the same speed. Should be possible to adjust the Velocity of the GoTo Driver based on that, of course only if this the reason for the issue described above.

Naseband avatar Jul 02 '17 15:07 Naseband

Just re-read issue and remembered one important thing. Frames Per Second... As you may know, everything in SA depends on FPS. The greater FPS the faster the game (expect for swimming for some reason - its actually very slower with greater FPS).

So when doing such tests keep in mind that results will be (highly) inaccurate.

BitFros7y avatar Mar 06 '18 21:03 BitFros7y

There is no visual difference in the NPC movement at 30+ FPS. The NPCs will warp at the same rate, depending on how much Z velocity they have or travel on that axis.

Naseband avatar Sep 06 '18 17:09 Naseband