Multiplying vector to velocity returns high numbers

So what I want to do is to exclude the Y axis on the velocity but if I try doing this, the result it gives are numbers in the tens of thousands. But without the multiplication of the vector, it returns the regular velocity.

local currentVelocity = RootPart.AssemblyLinearVelocity * Vector3.new(1, 0, 1)

local currentVelocity = Vector3.new(RootPart.AssemblyLinearVelocity.X, 0, RootPart.AssemblyLinearVelocity.Z)

They both return high numbers.

image

The screenshot only has numbers up to 400. Did you send the right screenshot?

I just figured that the problem was where I divide vectors. I don’t know why this would happen

local currentVelocity = RootPart.AssemblyLinearVelocity * Vector3.new(1, 0, 1)

local currentSpeed = currentVelocity.Magnitude
local velocity = direction * MaxSpeed
local deltaVelocity = velocity - currentVelocity

local currentSpeedSequence = math.clamp(currentSpeed / MaxSpeed, 0, 1)
Acceleration = EvaluateNumberSequence(Acceleration, currentSpeedSequence)

local force = deltaVelocity / Acceleration <-- lies here

I assume that the value of Acceleration is very low (0.001 or lower). What’s the function EvaluateNumberSequence doing??

I already solved it with this:
local force = if Acceleration > 0 then deltaVelocity / Acceleration else deltaVelocity

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