While creating a guided missile, directly moving towards a target (so no proportional navigation, just basic stuff), I discovered that using the exact same code the deprecated “BodyVelocity” and the new “LinearVelocity” behave differently.
This code sets a new velocity every frame pointing to the target from the missile.
While getting near to the target from behind (due to the following nature, this is normal behavior for this missile), LinearVelocity stops working and often seems to ‘bounce’ back from the target and thus never reaching the target. This can often be prevented when the velocity difference between the rockets is larger, but that’s both a bit unpredictable and feels like a bad fix.
I find it hard to describe the issue into words, but I added a video below that shows the issue (first showing the working, deprecated asset, then using the new asset).
robloxapp-20240215-1111067.wmv (2.1 MB)
Also, here is a proper testing place where the issue is recreated.
GuidedMissile.rbxl (101.5 KB)
Sidenotes:
When using LinearVelocity, I employ a BodyForce (deprecated) to counteract the gravity. The bug I describe may very well have to do with using this item in combination with the LinearVelocity, but the rocket does not function at all without it (just dropping due to the gravity).
I do not like the .Touched event, so I detect whether the rocket reached the target with a .Magnitude check. The bug I describe also occurs when using the .Touched event.
To test the bug I describe in the attached place, you can just play, use the item in the backback and switch between the modes using the only GUI button visible. Only one rocket can fly at a time and firing works using a single click on any BasePart. A single horizontally moving part can be found, just as three stationary parts.
I hope you can look into this, I’ve not seen much discussion on LinearVelocity on the web in general, and nothing describing this specific issue.
If you need any more information I’m happy to oblige!