Weird question, I know. There are so many ways to do this and I'm losing my mind trying to understand which would be best for my project.
My player makes multiple shapecasts to detect ledges in 3D space. Usual platforming shinanighens. Currently I am doing a downward shapecast which I update the transform on and then call update_force_transform()
to force Godot to update the shapecast's transform data immediately. Straight afterwards I try reading the collision data. This works, I get frame-perfect (I believe) collision data from the node and I can use this to consistently detect ledges when when moving at speed.
Problem:
- Sometimes the collision data returns the bottom of a thin ledge rather than a top. I would expect the shapecast to detect the top of the ledge in its downward sweep. I've heard this can be a byproduct of trying to use shapecasts with
update_force_transform()
as I currently am.
So my question is, by taking this route am I building smelly, unmaintainable code? If so, what should I swap to? Options I am aware of include:
- Build my own frame-perfect shapecasts using
PhysicsServer3D
. Doable but a bit of a hassle to set up.
- Rearchitect my physics logic to use
call_deferred
for checking the actual collision data