ok so. I need know how i can get Upper edge no matter what rotation.
for example
and
and then i will try do climbing thing
ok so. I need know how i can get Upper edge no matter what rotation.
for example
and
Oh god. Sorry for bad english. Cuz im rushing with that idea.
Are you trying to get the UpVector of the part?
I need get Edge of a part. to make climb thing.
EDIT: But edge should be always on top no matter what rotation
Do you mean like you need a 2d plane to represent the top of the part? Or do you need some sort of point on the edge of the part
Did you played parkour games? I want recreate moment then character climbs on edge.
Ok I understand. But like what are you trying to get here. A point on the edge of the part. The y pos of the part? Your not helping much
Check out this link
in other words
i need get closest edge point of part. no matter what orientation. so i can climb on it by checking magnitude of it.
This is a script that get’s all the corners of the part, maybe you can build off of this:
local MainPart = -- The part
local Vertices = {
{1, 1, -1}, --v1 - top front right
{1, -1, -1}, --v2 - bottom front right
{-1, -1, -1},--v3 - bottom front left
{-1, 1, -1}, --v4 - top front left
{1, 1, 1}, --v5 - top back right
{1, -1, 1}, --v6 - bottom back right
{-1, -1, 1},--v7 - bottom back left
{-1, 1, 1} --v8 - top back left
}
local function CreatePart()
local Part = Instance.new("Part")
Part.Size = Vector3.new(1, 1, 1)
Part.Anchored = true
Part.CanCollide = false
Part.Parent = workspace
return Part
end
for i, v in pairs(Vertices) do
local Part = CreatePart()
Part.Position = (MainPart.CFrame * CFrame.new(MainPart.Size.X/2 * v[1], MainPart.Size.Y/2 * v[2], MainPart.Size.Z/2 * v[3])).Position
end
Basically you can try getting all of the corners and connect the parts. It gets the corners no matter the orientation.
you can raycast from the client towards the approxamite direction of a grabbable ledge, sort of like this
I need do with no matter rotation. for this scritpt it matters.
How i would do it. I need ALWAYS get upper edge
you can compare the position of where the ray hit with the height you have from the part it hit, then compute it enough to see if
A: the overhang is at least a certain amount of degrees
and
B: if it is in range to be grabbed
Alredy working on it btw thanks for help