Hi there.
Is there a way to change the Origin/Pivot of a CollisionShape3D, or alternatively, add a node “inbetween” a CharacterBody3D and CollisionShape3D?
My CharacterBody3D has a skin node which I use as a visualization of the player character. As part of the game, this skin will have its basis change and rotate around. I want the player collision to match this rotated skin, however, the BoxShape3D which I am using as my CollisionShape3D has its origin in the center.
I can’t seem to figure out how to move it - it looks like its required to be in the center. At same time, I am unable to put a Node “inbetween” the CharacterBody3D and CollisionShape3D since then I get the warning that the CharacterBody3D has no shape.
How can I deal with this? I’d just like the pivot/origin to be at the bottom, not the center.
The “GroundAligners” aren’t relevant. The skin uses two nodes for easy transformations but for all intents and purposes this could just be the CharacterBody3D and the CollisionShape3D.
I’ve found an OK solution: Simply using a Convex Shape and manually reconstructing the box shape allowed me to “kind-of” set the pivot manually. A bit of a shame for the performance impact this will have but this resolves the issue.
I don’t fully know how the hell I got here, but here are my strange findings for you:
So, what could work:
A: Try parenting the CharacterBody3D to a new node3D. Your movement will be wonk, so you’ll have to put in code to compensate, but the node3D should act as a new origin point.
B: Supposedly there is a way to move the origin of a shape when or before it’s imported…I couldn’t find anything on that.
C: This method made me actively feel like I was on crack, and I still don’t fully understand how it works even though I was the one who coded it. But, if you use the collider as the parent for a mesh instance (or a different shape without collision, as long as it’s the same shape as the collider…I think) and then give the mesh instance a node3D, AND THEN set the mesh Y pos to go down by half the height of the collider (and the node3D to go up half the height), you could put the following code in: