What the "Primitive components" actually are? And when should I use them?

(the question is in the header)
I can’t find information.

It is a silly question which does not deserve to receive an answer, or it’s a very hard question?

I think it’s because people rarely use them. A primitive is basically a shape similar to a static mesh. You can add vertices to it dynamically and create a mesh on the fly. I personally haven’t checked how they work in UE4, but you got me curious now.

Thank you.

"Primitive Components

PrimitiveComponents are SceneComponents that contain or generate some sort of geometry, generally to be rendered or used as collision data. There are several subclasses for the various types of geometry, but the most common by far are the CapsuleComponent, StaticMeshComponent, and SkeletalMeshComponent. CapsuleComponents generate geometry that is used for collision detection, but not rendered; while StaticMeshComponents and SkeletalMeshComponents contain pre-built geometry that is rendered, but can also be used for collision detection. "

From here.

Capsule is inherited from this class, so most likely almost everyone uses it :slight_smile:
I also often use the box primitive for collision detection (trap damage for example).

As long as you don’t want to implement an own primitive, I suppose you don’t have to do anything with this class.

5 Likes

Thanks, but I don’t get, if “PrimitiveComponents … contain … some … geometry … to be rendered or used as collision data” including StaticMeshComponent. What is the StaticMesh per se (not as subobject of the PrimitiveComponent)? I don’t see any difference. Because StaticMesh can be used per se for the same purposes. (to be rendered or used as collision data)

If you want to modify its shape during gameplay you use a primitive component. Static meshes are, well, static so they cannot be changed.

There’s a game called Fracture for example that let’s you fire shots to the ground to modify it.

primitive components aren’t always made out of triangles like a mesh component. the sphere component is perfectly round, without having to waste alot of data on vertex positions, because it just uses a distance formula to check if something is within its radius. if the sphere component is visible, it doesn’t have to draw wireframe polygons, it just has to draw 3 ellipses.

I usually have to use this node prior to a Set Material, if I want a material to change due to some kind of interaction. I deduced this from hovering over pins and reading the error log. I don’t really know why, though.