Perhaps I will extract the Sensor-replacing code from my game, set it up in a sandbox environment and post it here so we can dig in and see if we can figure out exactly why it isn’t working.
Seemingly, from what it appears, if I am manually assigning a surface to be climbed with a script + sensor, if I am falling very fast or onto a strange surface, I will sometimes slide left and right unintentionally.
I have no idea if this happens with your default climb sensor - I cannot test it it’d require me setting up a really tall ladder that works with the default climb detector.
But feel free to test yourself; You can see clearly that there, almost every time I attach to the wall here - which in my case is the climb sensor detecting a flat object - I slide around a ton.
My game is about, well, climbing! So you can see why this sort of makes-or-breaks it for me.
hello. I have broken the offending element down into a basic place file;
Please ensure that whatever experience this is uploaded to has the CCL enabled in Avatar Settings.
You will find a Character Script that turns the Climb Sensor to manual, then raycasts in a loop to populate the Climb Sensor.
Included is a large tower. This tower is ‘Climbable’; ie, the script will raycast against it.
To replicate my bug, please Jump off the tower, then attempt to grab on to it mid-air, like shown.
From my perspective, this should be a ‘correct’ way to do this, even if it’s very simplified from what your rather creative staff can come up with? I checked the code provided by @GeometriCactus and while it is more advanced, at the end of the day it is still just setting the normal + sensed part, I think. Which is just what mine does, but with many many extra steps.
The climbing sensor rotates your character to face the hit normal.
Traditionally we use the -lookDirection as the HitNormal here so the character does not rotate when climbing.
You are setting the HitNormal to be the actual normal from the hit, so your character is rotating to face the wall its climbing. When the character is falling at a significant speed this generates significant linear momentum which is causing your character to angle off as your character grabs on.
The climbing sensor also only wakes up if there is a change to its inputs, so its not adjusting your input vector as a function of the character rotating to face the wall - which causes your character to climb up at an angle afterwards.
The keep it simple fix is just to use the look direction as the HitNormal as we normally do
local Look = Vector3.new(CharPivot.LookVector.X, 0, CharPivot.LookVector.Z)
ClimbSensor.HitNormal = Look.Magnitude > 1e-4 and -Look.Unit or NormalCast.Normal
If you want to rotate the character to face the wall that’s a bigger lift - I had success using the look vector as the HitNormal until the character slowed down, then lerping it to face the wall.
You then need a mechanism to disable the sleep on the climbing sensor - you can’t directly edit the climbing sensor but you can create / add another ability that starts with it and keeps it awake.
Absolutely.
The CCL is designed to drive any model with a root part.
The CCL does this by setting up another system, ControllerManager, which produces Humanoid-like movement on generic objects (You can also use this system in isolation without the CCL).
The CCL has a few extra things it does IF its attached to a humanoid - but it does not require one :
It sets EvaluateStateMachine = false on the humanoid, which turns off its internal force logic so it plays nice with ControllerManager, and the CCL keep the humanoids state up to date with whatever its doing, so legacy scripts should continue to function.
Everything else you said makes a lot of sense, I’ll try it, though I don’t really know what this part means. as far as I can tell the sensor that I am manually firing is “awake” as I manually fire it, I don’t really know what a sleeping climb sensor implies or when it’d be doing it?
Are you implying that even as I manually set the climb sensor, it’s somehow.. asleep?
Really, I’ve been skipping this entire “Ability” system as it still doesn’t make much sense to me.
Like I can vaguely picture what it does, custom abilities! But then everything I see about it is just… a lot to take in.
Will the CCL allow for players to float in water? That was sort of a pain point with the old humanoids - with having to edit body density in order to make players float. I haven’t had a chance to look into this, but very interested in jumping over if there’s floating involded.
Apologies I mistyped in that last message, you are totally correct the ClimbSensor is fine.
TLDR : I wouldn’t worry about that block, if you hit problems bug me and I’ll sort you out.
The long explanation :
The climb sensor looks for if there is something climbable in front of me, and runs a lot.
There is also a ClimbAbility, which passes data from the ClimbSensor down into the internal engine logic (ClimbController) which does the physical climbing movement.
The ClimbAbility will sleep if it doesn’t think It has anything to do.
If you change the climb sensor to continuously change the hitNormal, it won’t catch that by default.
You can’t really edit the ability in place - but you can sneak in a new ability - that block above - that keeps the climbing from sleeping in that case.
TLDR - dont worry about it, if you get to that level of problems you are in a good spot, I’ll sort you out.
Lots of floating options, the ideal solution is going to depend a bit on exactly what you want.
This is an ability, which stacks on top of the normal swimming, and which adds a force up onto your character while you are swimming, but not at the surface.
The force is relative to the total mass of the character, so it should handle accessories and UGC.
Simplest possible version - legacy auth only - START HERE SurfaceFloatLite.luau (2.1 KB)
Full power version that handles server auth + character weight changes SurfaceFloatForce.luau (3.9 KB)
Both of these have tuning parameters you can change to make it stronger / weaker - could definitely tune a Valheim style float where the float overwhelms your ability to swim down.
If you want to float higher in the water you probably want your own version of the water surface sensor.
Well this has certainly been very fun to learn, haha, seems like a lot of good stuff going on in the background. I’ll keep messing with it and let you know my results.
I’m a pretty odd type of coder, I do very complex things in pretty blunt ways, so I’m sure I’ll have plenty more shenanigans to get up to in the future regarding this system!