#Help me make these footsteps align with the ground please
1 messages · Page 1 of 1 (latest)
that is called procedural animations btw, and I suck at it so I won't be able to help srry
This might help: https://youtu.be/DPpAsjUr278?si=PQZkHyvUcCup_FVx
It doesn't go very deep into scripting but it does show you how you could set up a model with ik controls (The thing you use for procedural animations).
In this video you'll learn how to easily make procedural animations in Roblox using these 4 steps. I hope you enjoy the video!
RigEdit Lite:
https://create.roblox.com/store/asset/1274343708/RigEdit-Lite
My procedural animation module: https://create.roblox.com/store/asset/17842459894/Proce...
And this tutorial you might just want to watch to understand IK Controls a little better: https://www.youtube.com/watch?v=iWRlgOw8fW4&t=179s
Inverse kinematics is the mathematical process of calculating the variable joint parameters needed to place the end of a kinematic chain.
Become a member for great Channel and Discord perks!: https://www.youtube.com/channel/UCmIFjYx2aXrTjy5H8Zz1IfA/join
Discord Server: https://discord.gg/Fk8CF67RE7
If the invite doesn't work, try it from here:...
no no, i just want the footstep parts to be aligned with the ground
Yeah that is what you use IK Controls for
rotation-wise?
Or Ig if you don't want it to be that precise you could probably also rotate the character
no no i mean the footstep parts, not the actual legs
So do you want the whole model to be rotated or just the legs?
local characterPosition = humanoidRootPart.Position
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = {character, footstepPart}
raycastParams.FilterType = Enum.RaycastFilterType.Exclude
local rayOrigin = characterPosition - Vector3.new(0, 1, 0)
local rayDirection = Vector3.new(0, -100, 0)
local raycastResult = workspace:Raycast(rayOrigin, rayDirection, raycastParams)
if raycastResult then
local groundY = raycastResult.Position.Y
local feetY = characterPosition.Y - 2.8
local finalY = math.min(groundY, feetY)
local finalPosition = Vector3.new(characterPosition.X, finalY, characterPosition.Z)
local surfaceNormal = raycastResult.Normal
local upVector = Vector3.new(0, 1, 0)
local rightVector = upVector:Cross(surfaceNormal)
if rightVector.Magnitude < 0.001 then
rightVector = Vector3.new(1, 0, 0)
else
rightVector = rightVector.Unit
end
local backVector = surfaceNormal:Cross(rightVector).Unit
footstepPart.CFrame = CFrame.fromMatrix(
finalPosition,
rightVector,
surfaceNormal,
-backVector
)
else
local fallbackPosition = Vector3.new(characterPosition.X, characterPosition.Y - 3, characterPosition.Z)
footstepPart.CFrame = CFrame.new(fallbackPosition)
end
simple raycast to align it with the surface
obviously tweak it to how your game is but thats really all you need
this was my use case
Thank you for circling it and adding a here text
ooh you're talking about the footprints behind the character, not the character's legs (which would probably need IKControl). you'll need to use a raycast to get the surface normal from where the footprint was placed. it won't be perfect (e.g literal edge cases when its too close to an edge), but it should be good enough
a bit like your selection circle 👍
finalY he sent the script
he didnt lol thats the one i wrote if he changes it a little bit hell get the effect he wants