I am making a rocket launcher, everything works, it is just that the rocket doesn’t shoot in a straight line to the target, and often slopes downward in a squiggly line and then to the mouse pos. The rocket model itself also spins around while still going to the direction like a ragdoll too. Does anyone know how to fix this? Here is the function:
local function createAmmo()
local ammoPart = replicatedStorage.Assets:WaitForChild(ammo):Clone()
local primaryPart = ammoPart.PrimaryPart
local attachment = Instance.new("Attachment")
local linearVelocity = Instance.new("LinearVelocity")
local direction = (mousePosition - muzzlePosition.Position).unit
attachment.Parent = primaryPart
linearVelocity.Attachment0 = attachment
linearVelocity.MaxForce = 2000
linearVelocity.VectorVelocity = direction * 250
linearVelocity.Parent = primaryPart
ammoPart.Parent = workspace
ammoPart:PivotTo(muzzlePosition.CFrame)
end
You don’t have to put new in quotes, it is definitely new. The problem is this can cause unexpected issues in code. I also disagree when you say it’s faster and has features the latter doesn’t. Roblox wouldn’t deprecate something in favor of something else with less control/configurability.
BodyVelocity actually is faster, I have tested it myself. Setting Velocity, AngularVelocity, AssemblyVelocity, all of them are slowler in physics than adding in (or cloning, for better result) a bodyposition inside of the part. Before, I used linearvelocity to add bullet knockback, and it was slow and half the time didn’t even apply velocity.
Now that I added bodyposition instead, the results are always perfect and it works 100% of the time. So I do think that bodymovers are better.
BodyVelocity and manually assigning velocity itself are two different things, and will have 2 different effects. If you use LinearVelocity and still are having problems, you just aren’t using it right.
BodyPosition is also different from LinearVelocity. LinearVelocity attempts to maintain a velocity, but BodyPosition attempts to translate to a 3d point. They work differently. It’s not a valid comparison.
if body movers do have different behavior than constraints, I do not get why Roblox removed them. Roblox could have at least made constraints like linear velocity just as good, but instead they are slower yet deprecated items are faster in some cases like body movers.
It doesn’t matter. It it literally the only way to move players properly without a delay. You will have to use it anyway – trust me, I did literally everything I could think of to use Linear Velocities, ApplyImpulse, AssemblyLinearVelocity, etc. BodyVelocity is by far the best. Use it despite it being deprecated.
You haven’t done everything because you still have to use it despite it’s deprecation. I will try to fix this issue by requesting to Roblox it directly.
I have done everything. It’s literally a bug. The ROBLOX engineering team literally said they’re aware of the issue. You will not be able to fix the inherent engine issue with the LinearVelocity.
It’s not about trying to fix it, I use LinearVelocity in tons of games of mines, and it works perfectly fine. If you’re having problems with it not acting fast enough, simply increase the .MaxForce property. If you’re having problems with it glitching through walls, decrease the .MaxForce property. If you want it to only apply force upwards to obtain a velocity, use .MaxAxesForce.
It’s designed to achieve a certain velocity overtime, if this isn’t what you’re looking for you should try something else. (NOT BODY MOVERS)
Clearly, LinearVelocity has its limitations which BodyMovers can compensate for. Your idea of increasing the MaxForce literally does nothing, as it’s a problem with the Roblox physics engine. I know how LinearVelocity and other such forces work – however, to say that they are flawless and always better than BodyMovers is ridiculous and simply untrue.
Both LinearVelocity and BodyVelocity have their use cases – and in the case of this post, it would be better to use BodyVelocity. Just because something is deprecated, doesn’t mean it isn’t still useful.
You should update it’s position using cframe and renderstepped, not linearvelocity. For the best smoothness on all sides, each client should render it’s own version of the rocket instead of the server constantly updating each client on where the rocket is.