I have a character controller which uses default physics, VectorForce for movement, and AlignOrientation to stay upright. What I am trying to achieve is to “offset” said character controller with default physics to adapt to the ground, with behavior similar to the humanoid’s HipHeight property in a way.
So far, I have played with AlignPosition and it yielded results, being the closest thing to what I am looking for:
The only issue is that the constraint is set to a static position.
What other solutions (or partial solutions) I have thought of so far is that an array of raycasts (or even a radial one) could detect both the ground below the player, and whether or not they are in a falling/standing state.
Other than that, is there any way I could approach this, having default physics on my controller? If needed, I can provide an .rbxl or .rbxmx file with the controller model.
(This is my first time opening a new thread on here. If there is anything I may have missed or should clarify, please let me know! )
Yeah. Probably the better way would be to not use physics if you want a smooth transition to higher ground. Then manually Lerp the CurrentPosition. Or you could just try and smooth the camera(although that doesn’t really fix the problem)
Either that or have 2 different parts to your character where you have an invisible “collider” part and then a visible “character” part which would use AlignPosition to connect them together.
Like this:
For reference this is without the Align Position Smoothing.
Again, you could do your method of Raycasting downwards if you like as this solution does need a bit of tweaking to get right.
I wouldn’t mind at all! Apologies for seeing this so late. But to put it simple, after some consideration, I decided that I would take the CFraming approach to this. As with how most of the more in-depth controllers are done, I created a radial raycast (or array, whichever you’d prefer) and calculated the average height of each ray hit position on the Y axis. I would then take that value and then add the offset, while subtracting the controller’s current Y position from it. Something like this:
As this is the first character controller I’ve worked on, it’s not the most efficient and things are still being tweaked, but I hope this helped! I will probably post an update here soon showing the progress i’ve made.
(Been working on it on and off for about nearly two months now. 1,000+ lines of code and counting! )