Download

Engine/BasicShapes/Cube versus StarterContent/Shape_Cube differences

I’m currently learning Unreal and have been using primarily C++. During my experiments, I noticed that when I add created a Cube via C++, the cube’s appeared to be grounded at the axis (cube’s bottom face is centered at the RootComponent origin).

I was creating the mesh one of two ways: using the Starter Content’s Shape_Cube and using the engine’s Basic Shape Cube.


static ConstructorHelpers::FObjectFinder<UStaticMesh> BaseMeshAsset(TEXT("/Game/StarterContent/Shapes/Shape_Cube.Shape_Cube"));

if (BaseMeshAsset.Succeeded()) {
    mesh->SetStaticMesh(BaseMeshAsset.Object);
    mesh->SetSimulatePhysics(true);
}


static ConstructorHelpers::FObjectFinder<UStaticMesh> BaseMeshAsset(TEXT("/Engine/BasicShapes/Cube"));

if (BaseMeshAsset.Succeeded()) {
    mesh->SetStaticMesh(BaseMeshAsset.Object);
    mesh->SetSimulatePhysics(true);
}

I included two screenshots. The white cube is the Shape_Cube, and the black cube is the Cube.

Is it recommended to use the Basic Shape Cube versus the Starter Content Shape_Cube? Sorry, I know the question may sound a bit daft. I’m coming from Unity, so there is really only one cube and it is always centered.

One last question here. If I did not make the BaseMeshAsset variable static, would this create any issues? The code I have seen for finding the objects uses this particular pattern. It’s not clear to me if there is a lifetime issue or something else which is why static is being used.

Thanks!