I’m trying to make a touch soccer ball that moves based on the angle you hit it, but if you jump on top of the ball, it doesn’t move anywhere.
I think this is because the part that touched the ball is basically on the center of the ball, so it will not move anywhere. Unfortunately, I’m not sure how to fix this.
local function applyForce(part, ball)
local direction = (ball.Position - part.Position).Unit
print(direction)
local bodyVelocity = Instance.new("BodyVelocity")
bodyVelocity.MaxForce = Vector3.one * math.huge
bodyVelocity.Velocity = direction * 20
bodyVelocity.Parent = ball
task.delay(0.3, function()
bodyVelocity:Destroy()
end)
end
For anyone confused, I’m willing to provide anything, like a video or place file etc
BodyVelocity is an outdated object. Use VectorForces instead.
Create a new VectorForce and check the ApplyToCenterOfMass.
Set the Force to be something big, in your case the direction. Also, if it doesn’t work, you can try setting the RelativeTo to World, or create an attachment and set the Attachment0 property to it.
local vectorForce = Instance.new("VectorForce")
vectorForce.ApplyAtCenterOfMass = true
vectorForce.RelativeTo = Enum.ActuatorRelativeTo.World
vectorForce.Force = direction * 20
vectorForce.Parent = ball
Well probably because you are on top of it, so the ball now needs to also push up on you. You can also check the direction on the Y is positive when you jump on it. If it’s not positive then it’s going into the ground.
As for you, you can set all the character’s bodypart’s Massless property to true.
But also if you’re jumping on it there is no reason it should move horizontally, it’s trying to move up or down.
Yes, this has been one of the problems in the game, when a player tries to touch the ball in the air, sometimes they will hit the center of the ball with their head and it will not travel as far and it has been a big issue.
Well probably because you are on top of it, so the ball now needs to also push up on you.
In this case, the player will always (mostly) have just a tiny offset from the center of the ball, say even if it is 0.01 studs away from the x axis, I want to make it fully go in that direction anyway.