RootCapsuleComponent - Sits Below Origin

Serious issue with the Root Capsule Component, either that or I’m mistaken in what it’s for (collision i thought?).

Anwyay, the problem is that the Root Capsule Component’s CENTER is the origin, instead of it’s bottom. So, any mesh that i place in with it also has to have it’s CENTER at the origin so that the Capsule Component encapsulates it as accuratly as possible.

Here’s the issue.

As you can see, whenever I place my characters in the level they are half above the coordinate they were placed and half below it. Incase you’re wondering what the mesh/capsule look like, the mesh needed to be displaced at -60 pixels to be neatly tucked in the capsule. This can’t seriously be the default/intended behavior, can it?

1 Like

This problem is also in the RTS (and FPS?) demo. All of the meshes in the RTS demo are negatively displaced from the origin of the Root Component.

This means that if you wanted to move one actor to the location of another, you would have to consider their respective meshes displacements from the Root Component if you wanted them to appear at the same height.

This means that we would have to store a static const holding the Z displacement so that we could compare them at run-time. Obviously this is not ideal.

The only way I can see around this dilemma is to make a few assumptions. A positive “Capsule Half Height” would represent the top of the object and a negative would represent the bottom. Capsule Radius along with some trig could give you any point on that object’s border.

We’re given pretty much the same number of mathematical guarantees as we have when standing meshes on the XY plane, just the forumlas/assumptions are slightly different, so it becomes a non-issue. That said, I would seriously consider having my artists center all objects on the origin instead of simply standing them on it.

For non-standard-Character blueprints with different types of collision geometries you could keep the same number of assumptions as you could with any other object, only the formulas would change. Since centering an object on the origin is something that any of the big programs can do, it’s probably even better this way.

Actually you wouldn’t even need to set your meshes centered on the origin. Just knowing the Half Height of the capsule and the radius you could calculate the top, bottom, and corners somewhat generically.

When you spawn actors within editor, their origin being snapped to objects for precise placement.

Just take them above the ground and press End to perform sweep for “normal” placement.

For run-time spawning you’d like set spawn location to half-height of the capsule, i guess.