Help with setting body position using leg position and offset

hello devform, for the past few days i have been trying my best to learn procedural animations. one of my recent ventures is creating a procedural animated creature, the problem that i am facing is that when its walking up slopes i want the body position and rotation to change kind of like this Unity procedural animation tutorial (10 steps) - YouTube, i have no idea how to do it

maybe this will help?

1 Like

Yooo thank you this is what I needed

1 Like

Normally, getting the normal (pun intended) would be the best option but in the case that theres rocky terrain or something the body could be off-centered, so I thought Id just drop this here in the case that you run into any problems with the other system

I would personally recommend getting the average of the left and right legs and using that as a reference point for turning like so

local right = (frontRightLegEndpoint+backRightLegEndpoint)/2-(frontLeftLegEndpoint+backLeftLegEndpoint)/2
bodyCFrame = CFrame.fromMatrix(position, right, right:Cross(bodyCFrame.LookVector))

workspace.body.CFrame = bodyCFrame

Raycasting on a non-smooth surface:

Doing the other thing on a non-smooth surface:

2 Likes

Sorry for the late reply but is it possible for you to send me the rbx file for that place cause I don’t really understand what you mean, because I am terrible at math

I closed out of it last night and didnt save it, but basically what you can do is do what he described in the video and use the average of those target points on the left and right separately and just use the difference between those two average left and right points as the right vector of the spider thing
Most of the stuff in my system was badly coded as a proof of concept anyways, and isnt probably how Id do it in a final product

1 Like

Well that sucks but I bet I will figure it out soon thanks for the help though

I can try to recreate it better of you want me to, theres probably a lot of considerations I didnt think about

1 Like

No it’s fine my dude it would be a better learning experience if I did it my self

1 Like