My bumpers only hit from only three sides

I’m creating a marble game, and I’ve created a bumper. I used a Vector3 to have the ball be bounced from the sides as well as the top of the block.

  1. What is the issue? My bumper only hits three specific sides of the XYZ axis (back, right, top) and I wish it to hit from the other 2 sides of the block:

  1. What solutions have you tried so far? I haven’t checked any new solutions, but I was looking on the Roblox Developer Hub documentations for help. So far, nothing helpful yet. This is the bumper’s script:
local hitbox1 = script.Parent

local isTouched = false

local function bounce(ball)
	if not isTouched then
		isTouched = true
		hitbox1.Velocity = Vector3.new(60,60,60)
		
	end
end

hitbox1.Touched:Connect(bounce)

hitbox is defined as script.Parent. What is the script parented to? The bumper, or the ball?

The likely issue, with what info I have, is that since you’re always applying the same velocity, the ball is always going to move in the same direction – which impies that it must also, at a certain position around the bumper, simply be thrown into the bumper itself rather than away.

1 Like

I see. And about where the script is parented to,
The script itself is parented to the bumper

Adding onto what @Blizzero mentioned in his reply. You can get the direction of the knockback by subtracting the ball’s position and the bumper’s position and using the unit from that:

local direction = (ball.Position - bumper.Position).Unit

You would then just multiply that to your liking:

ball.Velocity = direction * 100 -- 100 is just an example
1 Like

Awesome! I’ll give that suggestion a try.