Vector3 Size issue

I have a wrecking ball that im testing out, and to make it work better I want to multiply the velocity with the size, (faster the wrecking ball goes, the more damage it does)
yt link to what i want it to look like:

as you can see in the video, the red part changes in size (which is what i want to make bigger depending on the velocity) the reason i need the red part, is because its the reason how the parts are actually breaking, the actual wrecking ball just pushes it over.

my current code for the sizing:

local value = script.Parent.VelocityValue --value that stores the velocity
local ball = script.Parent.Destroypart --the red part
while true do
	task.wait()
	value.Value = script.Parent.AssemblyLinearVelocity
	--print(value.Value) --this is just for testing
	ball.Size = ball.Size + ball.Size * Vector3.new(value.Value) --the line thats not working
	print(ball.Size) --this is also for testing
end
2 Likes

What is the actual problem?
Is your sizing of the Red Area not working?
Is the damage not happening as strong as you want?

Not sure I get what the problem is, considering in the video the Red Area changes size with your velocity, and you seem to be doing damage to the blocks within that Red Area.
???

the sizing of the red area not working.
that video isnt mine, i said i want it to look like it.

oooooh I see.
You would start out with a starting Vector3, which is the smallest your red area is, when the ball has no velocity

Then you decide what is the maximum velocity and the largest size you want to have as the limit

Then whatever the ball’s velocity is currently, you do… velocityRatio = (maxVelocity-currentVelocity) / maxVelocity

So then you set the size minSize+ ( (maxSize- minSize)*maxVelocity)

I think that’s correct.
Of course these are Vector3’s

max velocity? what do you mean, i dont think theres a limit

I meant if you set a limit, so the size of the red area didn’t just go out of control
But really if thats not an issue, you don’t need a limit, just a ratio of how many studs larger for how much velocity change.

Such as if you wanted it to get .5 studs bigger every 1 velocity increase, you would just do
redSize = smallestRedSize + (currentVelocity * .5)

1 Like

so my current code is

local ball = script.Parent.Destroypart
local maxvelocity = Vector3.new(11,-25,47)
local maxsize = Vector3.new(12.5,12.5,12.5)
local minsize = Vector3.new(7.429, 7.429, 7.429)
while true do
	task.wait()
	local currentvelocity = script.Parent.AssemblyLinearVelocity
	value.Value = currentvelocity
	print(currentvelocity)
	local velocityRatio = (maxvelocity - currentvelocity) / maxvelocity
	ball.Size = minsize + ( (maxsize- minsize)*maxvelocity)
	--ball.Size = ball.Size + ball.Size * Vector3.new(value.Value)
	print(ball.Size)
end

but it doesn’t work, it just makes the red part huge, to the part where u cant see it but u can see the shadow. and the size never changes, it just sets to 63.21000289916992, 0.0010000000474974513, 245.76600646972656

image

local ballPart = script.Parent.BallPart
local redBall = script.Parent.Destroypart
local maxvelocity = 50--Vector3.new(11,-25,47)
local minsize = redBall.Size.X -- Vector3.new(7.429, 7.429, 7.429)
local maxsize = 12.5
local multiplier = (maxsize - minsize) / maxvelocity 

while true do
	local currentvelocity = ballPart.AssemblyLinearVelocity.Magnitude

	local size = math.min(	(currentvelocity*multiplier)+minsize, maxsize )
	redBall.Size = Vector3.new(size,size,size)

	task.wait()
end

1 Like

yo no way i didnt think you would be able to fix that thank you so much

1 Like

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