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"

Attached actors or components physics collision


I'm struggling a lot to make a simple feature of my game work.

In my game I have a vehicle on which you can attach extra parts (tools, weapons, etc ...). An extra part is an independant Actor that by default lays on the ground and that can be picked up and attached to the vehicle.

Here a simple example, you can think of the extra part as some sort of vehicle tunning to bump into zombies during an apocalypse. (the image is not from my game, it is just for the example) alt text

What I need is that, when I'm driving my car, the bumper has to collide with other actors. However after many days lost on this, I cannot make it work. The bumper always overlaps any other actors when my car run into them. For example, I smash the car into a wall, the bumper will overlap and only the car will collide. However the bumper collides properly with other actor when not attached to the car.

I'm attaching the bumper via C++ (but it's the same with the AttachToActor Blueprint node)

 AttachToActor(VehicleActor, FAttachmentTransformRules::SnapToTargetNotIncludingScale);

After reviewing all this answers, I could not make it works either : https://answers.unrealengine.com/questions/37576/activating-physics-detaches-component.html https://answers.unrealengine.com/questions/13767/multiple-constraints.html https://answers.unrealengine.com/questions/326577/collision-of-attached-actor-does-not-work-correctl.html https://answers.unrealengine.com/questions/762569/attached-component-to-actor-has-no-collision.html?sort=oldest https://answers.unrealengine.com/questions/663248/attach-actors-with-physical-collision.html

Is it even possible and how do I enable collision on the bumper (child actor) when moving the car (parent actor) ?

Product Version: UE 4.19
84481954.jpg (119.5 kB)
more ▼

asked Aug 23 '18 at 06:37 PM in C++ Programming

avatar image

1 1 8

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

1 answer: sort voted first

Found the solution !

I needed to create a UPhysicsConstraintComponent attached to the car skeleton, then apply the constraint between the bumper skeleton and the car skeleton.

Now I got my collisions perfectly working ! When I drive the car into a wall, the bumber collide and the whole car stops without the bumber passing through the wall. Hope it helps someone else.

Below the variables are :

  • BumberSkeletonComponent : the SkeletalMeshComponent belonging to the bumber actor

  • CarSkeletonComponent : the SkeletalMeshComponent belonging to the car actor

  • SocketName : the attachment socket on the car skeleton

The code :

 BumberSkeletonComponent->SetWorldTransform(CarSkeletonComponent->GetSocketTransform(SocketName), false, nullptr, ETeleportType::TeleportPhysics);
 UPhysicsConstraintComponent* Constraint = Cast<UPhysicsConstraintComponent>(NewObject<UPhysicsConstraintComponent>(CarActor, UPhysicsConstraintComponent::StaticClass(), FName(TEXT("Constraint"))));
 Constraint->AttachToComponent(CarSkeletonComponent, FAttachmentTransformRules::SnapToTargetNotIncludingScale, SocketName);
 Constraint->ConstraintInstance.ProfileInstance.bDisableCollision = true;
 Constraint->SetConstrainedComponents(BumberSkeletonComponent, NAME_None, CarSkeletonComponent, NAME_None);

more ▼

answered Aug 29 '18 at 08:27 PM

avatar image

1 1 8

(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