x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

CameraComponent attaches StaticMesh to Actor

Hey in one function i collect all staticmeshcomponents of an actor to make stuff with their meshdata. now i noticed that the cameracamera component attaches an static mesh to the actor that can#t be seen in the details panel. I want to exclude this static mesh because i dont need it, but how can i tell that the searched component is from the camera or not?

 ActorObject = GetOwner();
 
 ActorObject->GetComponents<UStaticMeshComponent>(MeshComponentList);


tnhanks in advance

sascha

Product Version: UE 4.15
Tags:
more ▼

asked Feb 26 '18 at 11:57 AM in C++ Programming

avatar image

SKerkmann
13 1 5 4

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hey!!

Yup Cameracomponent has a static mesh and guess what is that? The Camera itself :) At first if you check source code :

 #if WITH_EDITORONLY_DATA
     // The frustum component used to show visually where the camera field of view is
     class UDrawFrustumComponent* DrawFrustum;
 
     UPROPERTY(transient)
     class UStaticMesh* CameraMesh;
 
     // The camera mesh to show visually where the camera is placed
     class UStaticMeshComponent* ProxyMeshComponent;
     
     virtual void ResetProxyMeshTransform();
 
     /** Ensure the proxy mesh is in the correct place */
     void UpdateProxyMeshTransform();
 #endif

That meshcomponent is valid only with editor and will not builded in final game ;) So dont worry! if you creating a game you will not get that component because that will be invalid.. (but maybe will be added to array, but you can check for nullptr)

Another method for check that is a cameramesh...

 if (ProxyMeshComponent == nullptr)
         {
             ProxyMeshComponent = NewObject<UStaticMeshComponent>(MyOwner, NAME_None, RF_Transactional | RF_TextExportTransient);
             ProxyMeshComponent->SetupAttachment(this);
             ProxyMeshComponent->bIsEditorOnly = true;
             ProxyMeshComponent->SetStaticMesh(CameraMesh);
             ProxyMeshComponent->SetCollisionProfileName(UCollisionProfile::NoCollision_ProfileName);
             ProxyMeshComponent->bHiddenInGame = true;
             ProxyMeshComponent->CastShadow = false;
             ProxyMeshComponent->PostPhysicsComponentTick.bCanEverTick = false;
             ProxyMeshComponent->CreationMethod = CreationMethod;
             ProxyMeshComponent->RegisterComponentWithWorld(GetWorld());
         }

As seen here, Proxy mesh is hidden in game... i assume your meshes is visible in game, so you can remove hidden meshes from your meshlist ;)

or just get meshcomponent owner and if you can cast to cameracomponent... you need remove that

more ▼

answered Feb 28 '18 at 08:25 AM

avatar image

AmphDev
1.5k 15 9 34

avatar image SKerkmann Feb 28 '18 at 01:31 PM

Thanks AmphDev!

Yeah i've seen that it is the camera staticmesh if also looked into the engine code, still dident knwo how to intensionoly overlook all static meshes the engine spawns on components^^ But you tip withe bHiddenInGame looks like a good indicator for ignoring unintended meshes.

thanks again

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question