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"

How to Properly Handle Instanced Static Mesh Collision?

I've successfully created the Instanced Static Mesh Component. However, the character is falling through the terrain even with the collision setup below:

        RegisterAllComponents();
         ismc->ClearInstances();

         UStaticMesh* Rockmesh = LoadObject<UStaticMesh>(nullptr,TEXT("StaticMesh'/Game/StarterContent/Props/SM_Rock.SM_Rock'"));
         ismc->SetStaticMesh(Rockmesh);

         ismc->GetBodySetup()->CollisionTraceFlag = ECollisionTraceFlag::CTF_UseComplexAsSimple;
         ismc->CanCharacterStepUpOn = ECanBeCharacterBase::ECB_Yes;
         ismc->CanCharacterStepUp(UGameplayStatics::GetPlayerPawn(this->GetWorld(), 0));
         ismc->bGenerateOverlapEvents = true;
         ismc->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
         ismc->SetCollisionResponseToAllChannels(ECR_Block);
         ismc->SetMobility(EComponentMobility::Static);

         AForestController* ForestController = GetWorld()->SpawnActor<AForestController>();
         ForestController->generateTerrain(ismc);
         ForestController->SetActorEnableCollision(true);

AForestController is just an actor that manages the terrain generation, and ismc is a UInstancedStaticMeshComponent variable. I've heard Instanced Mesh Component supports collision. What is the proper way to handle the Instanced Static Mesh Collision, so that the character won't fall through the mesh? Any help towards this is appreciated!

Product Version: UE 4.18
Tags:
more ▼

asked Jul 06 '18 at 02:32 PM in C++ Programming

avatar image

Paul_LTC
30 3 3 9

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

The code above actually works. My character was spawned underwater. Silly me!

more ▼

answered Jul 07 '18 at 03:04 AM

avatar image

Paul_LTC
30 3 3 9

(comments are locked)
10|2000 characters needed characters left
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