How to stop a sphere from going behind the player?

Hello, I’ve been making a football field and is there a way I can stop the ball from going behind the player when it get pushed and be properly “kicked” foward?

This is more of a physics/building issue more than anything. Move this post to #help-and-feedback:building-support, close this one, and I’ll help you there.

Can’t I just change the post directly instead of making a new one?

If you can, I don’t know how. I would just delete this one and create a new post, or at least look around to see if you can change the category. I’m going to guess you can’t change it, though.

He literally just moved it to building support

2 Likes

You can achieve this with a single line of code thanks to impulses:

workspace.Ball:ApplyImpulseAtPosition((workspace.Ball.Position - hit.Position).Unit*5 + Vector3.yAxis*10, hit.Position)

I would recommend hooking this up to a hitbox or .Touched event so you can apply this impulse.
Hope this points you in the right direction! :slight_smile:

Okay, anyway, now that you have and you can avoid any trouble with forum mods, there are a couple things you could do.

Firstly, you could change the size of the ball. Saying it spawns on a 1x1x1 spot, I would change it to 3x3x3. I doubt you’d want to do that

And secondly, what I was just typing is what @Xitral did. Try that if you don’t want to change the size of the ball.

Theres a problem, the ball gets flung

Tune down the multiplier,

local kickPower = .5
workspace.Ball:ApplyImpulseAtPosition((workspace.Ball.Position - hit.Position).Unit*kickPower + Vector3.yAxis*(kickPower*2), hit.Position)
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.