Im looking for a “shortcut” way to clamp the y of a vector3, tried this:
local direction = part.CFrame.LookVector:Max(1, 0, 1)
didn’t work unfortunately
Im looking for a “shortcut” way to clamp the y of a vector3, tried this:
local direction = part.CFrame.LookVector:Max(1, 0, 1)
didn’t work unfortunately
What are you trying to do? Also the LookVector simply returns a vector of length 1 that points in the direction of the front face.
lookVector still has a y value, otherwise it wouldn’t be going up when I hit the ball.
So you have ball parts that move around and hit eachother?
a soccer ball and force gets applied to it, but it goes up because lookVector still has a Y value
Okay I will code a script for you to clamp a vector 3.
function clampVector3(inputVector : Vector3, min : Vector3, max :Vector3)
return Vector3.new(math.clamp(inputVector.X,min.X,max.X),math.clamp(inputVector.Y,min.Y,max.Y),math.clamp(inputVector.Z,min.Z,max.Z))
end
Now you give it two vectors that represent the limits of the input vector. So in your case put 0 as the Y component of the input vector.