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 i can disable specific body collision in physics asset on runtime?

Hello everyone! How i can disable specific body collision in physics asset on runtime? For example, i need disable arm or leg collision in Mannequin. I try use GetPhysicsAsset()->DisableCollision but it not work. alt text

Product Version: UE 4.20
Tags:
more ▼

asked Jan 31 '19 at 12:55 PM in C++ Programming

avatar image

dmitri2812
13 1 5

avatar image Flash7 Mar 08 '19 at 05:17 PM

Have you found a solution?

avatar image dmitri2812 Mar 09 '19 at 10:38 AM

No (8 characters needed)

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

1 answer: sort voted first

ok, I found the answer!

HideBoneByName() does actually work as intended. I tested it on my project and confirmed with C++ implementation. HideBoneByName is implemented in USkinnedMeshComponent and inside it calls HideBone(). HideBone() is overridden in USkeletalMeshComponent and it does account for EPhysBodyOp option and it effectively terminates all collisions for this bone and its children by calling TermBodiesBelow(). The only things is that collision bodies are still visible in debug (that what was confusing me, and I thought that collisions are still there). So what is needed to use for PhysBodyOption is "PBO_Term" to disable collisions.

If you do not want to hide a bone but just disable a collision, I would imagine you just need to call TermBodiesBelow()

 void USkeletalMeshComponent::HideBone( int32 BoneIndex, EPhysBodyOp PhysBodyOption)
 {
     Super::HideBone(BoneIndex, PhysBodyOption);
 
     if (!SkeletalMesh)
     {
         return;
     }
 
     if (BoneSpaceTransforms.IsValidIndex(BoneIndex))
     {
         BoneSpaceTransforms[BoneIndex].SetScale3D(FVector::ZeroVector);
         bRequiredBonesUpToDate = false;
 
         if (PhysBodyOption != PBO_None)
         {
             FName HideBoneName = SkeletalMesh->RefSkeleton.GetBoneName(BoneIndex);
             if (PhysBodyOption == PBO_Term)
             {
                 TermBodiesBelow(HideBoneName);
             }
         }
     }
     else
     {
         UE_LOG(LogSkeletalMesh, Warning, TEXT("HideBone: Invalid Body Index has entered. This component doesn't contain buffer for the given body."));
     }
 }
 

more ▼

answered Mar 09 '19 at 10:49 PM

avatar image

Flash7
839 9 17 29

avatar image dmitri2812 Mar 10 '19 at 03:30 PM

Thanks for help!

(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