Hello! I am working on an arcadey skating game prototype (haven't decided what type of skating, but that doesn't really matter at the core).
I thought I had the basic movement down until I tried a much steeper ramp than the ones I been trying previously.
Shallower ramps seem to work perfectly - I use the following code to snap the CharacterBody3D to the group. I use 3 raycasts to determine the normals (see attached image).
private Transform3D AlignWithY(Transform3D newTransform, Vector3 newY)
{
newTransform.Basis.Y = newY;
newTransform.Basis.X = -newTransform.Basis.Z.Cross(newY);
newTransform.Basis = newTransform.Basis.Orthonormalized();
return newTransform;
}```
```c#
public override void _PhysicsProcess(double delta)
{
...
if (IsOnFloor())
{
// normal avg
Vector3 normal = (frontRay.GetCollisionNormal() + middleRay.GetCollisionNormal() + backRay.GetCollisionNormal()) / 3.0f;
Transform3D newTransform = AlignWithY(GlobalTransform, normal);
GlobalTransform = GlobalTransform.InterpolateWith(newTransform, 12.0f * (float)delta);
}```
The problem I am encountering is that when I am moving up steeper ramps (as shown in the attached image), the movement is very choppy as the CharacterBody3D thinks that it is NOT on a floor or wall, so gravity is applying.
What I want is smooth movement up and down the ramp; essentially, I want the movement on ramps/slopes to feel no different than moving on flat ground. Of course, I'll work on momentum and stuff later, but for now, I just want to stick to the basics.
Does anyone have any ideas for a better approach or how I can correct the jankiness of the current setup? Also, would it better to not use a box collider for this?