# Curving Ball using Mover Constraints

Trying to curve the balls trajectory

``````
local ocCurveVector = (character.PrimaryPart.CFrame * CFrame.fromEulerAnglesXYZ(0 ,math.pi / 2, 0) * CFrame.fromEulerAnglesXYZ(math.rad(0), 0, 0)).LookVector

forceApplier:ApplyLinearVelocity(direction*Vector3.new(1,0,1),speed,maxForce,yForce,timeApplied,targetBall)
forceApplier:ApplyAngularVelocity(Vector3.new(0,50,0),500,0.3,targetBall)
forceApplier:ApplyForce(ocCurveVector*800,0.5,targetBall,true)
``````

My code

My issue with it is that the curve applies far too late and irregularly
I want it to be smooth
and applied almost instantly

3 Likes

Right away it sounds like a net code/ownership swapping issue, but on the off-chance that itâ€™s not:

• We donâ€™t know what the â€śforceApplierâ€ť module is to be able to help with/logic through those functions
• Your description of the problem isnâ€™t technical/specific enough to be confidently assisted with
• math.rad(0) is equal to 0
1 Like

Itâ€™s definitely not an ownership issue, in the video the ownership of the ball is with the client.

We donâ€™t know what the â€śforceApplierâ€ť module is to be able to help with/logic through those functions

I thought the functions names were self explanatory, but Iâ€™ll send the code if it helps.

Your description of the problem isnâ€™t technical/specific enough to be confidently assisted with

I donâ€™t know how else to describe it. Iâ€™m trying to make the ball curve inside (ie. to the left in this case).
ApplyLinearVelocity applies a forward and up motion, AngularVelocity is for the spin, and the ApplyForce is for the curve.

1 Like
``````function module:ApplyLinearVelocity(velocity,speed,maxForce,yForce,timeApplied,targetBall,curveVector)
local linearVelocity = Instance.new("LinearVelocity")
linearVelocity.RelativeTo = Enum.ActuatorRelativeTo.World
linearVelocity.MaxForce = maxForce
linearVelocity.VectorVelocity = (velocity * speed) + Vector3.new(0,yForce,0)
linearVelocity.Attachment0 = targetBall.VelocityAttachment
linearVelocity.Parent = targetBall

end

function module:ApplyAngularVelocity(angVelocity,maxTorque,timeApplied,targetBall)
local angularVelocity = Instance.new("AngularVelocity")
angularVelocity.Parent = targetBall
angularVelocity.Attachment0 = targetBall.VelocityAttachment
angularVelocity.AngularVelocity = angVelocity
angularVelocity.MaxTorque = maxTorque

end

function module:ApplyForce(vectorForce,timeApplied,targetBall,curve)
local vForce = Instance.new("VectorForce")
vForce.Attachment0 = targetBall.VelocityAttachment
vForce.RelativeTo = Enum.ActuatorRelativeTo.World
vForce.Parent = targetBall

end
``````
1 Like

The VectorForce is being applied relative to the world which I believe would mean itâ€™d be inconsistent based on what angle you kick the ball at, perhaps . . . ?

Working with Robloxâ€™s physics is unfortunately always going to be slightly variable in its results, so the unreliability is also something to take into account

1 Like

The issue isnâ€™t with the direction of the curve, the issue is with how late the curve applies

1 Like

Bump

1 Like

This is separate, but can i buy/recruit you for animations

1 Like

I can tell you how to do the curves, since ive done it on my own football game

1 Like

Can we see the code before you apply the force? Also the delay may be because you are creating instances, but Iâ€™m not sure.

1 Like

I checked and it seems the delay happens because of the LinearVelocity. No other force can be applied for some reason until the LinearVelocity leavesâ€¦ very weird

Iâ€™m not the animator, but I can give you the contact of the person who made them

1 Like

Did you use a physics based system? and did that system use BodyMovers or Mover Constraints?
Iâ€™ve done it before with BodyMovers however it behaves differently when ported to Mover Constraints

1 Like

This is kinda jank but you can try using task.spawn

So like:

``````task.spawn(function()
--apply force
end)
--apply force
end)
--apply force
end)
``````
1 Like

I donâ€™t really get the idea behind this.

What I want is for the force to applied simultaneously with LinearVelocity, wondering if theres a way to do that, thatâ€™s all.

1 Like

task.spawn() basically runs whatever code within there â€śseperatelyâ€ť than what comes after. So if you do task.spawn(function()