I have a been working on a remake of the 2007 physics (i know how original) and ive came into a problem to do with the animations.
You see when ever a play walks up/onto a part it plays the climb animations for a split second kind of flicking their arms back, the problem is that the script has no way to differentiate if a play walked over/onto the part and i don’t know how i would go about doing that
I’ve tried searching but all my results have to do with just touching a part because of how people word things and i have no idea how i would go about doing this.
(Video of March 2007 client)
as you can see in the video i can walk around ontop of a part and it wont flick the arms but as soon as i walk ontop of another part it flicks the arms if i used .Touched then it would activate all the time when ever im walking on or into the floor or a wall.
I was thinking something to do with raycasting but it will only raycast from one point and would be quite messy for everypart to have a raycast from it not to mention I don’t really know much about raycasting. All I’m really asking for is if anyone knows how i could detect if the player walked up ontop of a part and how i could achieve it as i have quite literally no ideas
Sorry i am REALLY bad when it comes to understanding this sort of thing you might have to explain in slightly more basic terms as i don’t really understand what you mean
I cant really go in depth without overgenerializing it becouse im just here telling you possible solutions and i really dont know what code you made nor do i want to know it in depth
Basically you can do a blockcast down like 2 studs (depending on hipheight) and see if it hits a surface that faces upwards or ALMOST upwards
You can raycast down each frame and keep track of the position the ray hit. Then, if it ever hits a different part and the hit position was above the last, we know the player walked up or jumped up.
Here’s a basic example of that:
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local localPlayer = Players.LocalPlayer
local character = localPlayer.Character or localPlayer.CharacterAdded:Wait()
local lastPart = nil
local lastPosition = nil
RunService.PostSimulation:Connect(function()
local primaryPart = character.PrimaryPart
if not primaryPart then
return
end
local humanoid = character:FindFirstChildOfClass("Humanoid")
if not humanoid then
return
end
local rayLength = humanoid.HipHeight + primaryPart.Size.Y * 0.5 + 0.01
local raycastParams = RaycastParams.new()
raycastParams.FilterType = Enum.RaycastFilterType.Exclude
raycastParams.FilterDescendantsInstances = { character }
local raycastResult = workspace:Raycast(primaryPart.Position, rayLength * -Vector3.yAxis, raycastParams)
if raycastResult then
if lastPart and raycastResult.Instance ~= lastPart and raycastResult.Position.Y > lastPosition.Y then
print("Player walked up.")
end
lastPart = raycastResult.Instance
lastPosition = raycastResult.Position
end
end)