Bug with Trace and onclick events

Simply with Actors on click events and trace events only work on them if they have static meshes but skeletal meshes or other components are useless and seem not to work.

only solution is to add a static mesh and set it to be visible after covering up required area u need.

UE4 4.4

What kind of collision preset is your skeletal mesh using?

Hey

We haven’t heard back from in you a while, so I am marking this post resolved for tracking purposes. If you are still experiencing this issue, please give us details requested above. Thanks!

I cant see collision preset for a skeletal mesh only if its a static mesh.

No solution yet , only hack i found was to import a cube mesh into ue4 and cover your whole static mesh with it and then set it to hidden in game , then onclick actor events would work.

In your Blueprint Components tab, select Skeletal Mesh component and scroll down to Collision Presets in Details panel. Expand that section and tell us what settings you have or grab a screenshot and post it here for us. Thanks!

Its pawn preset tried with trigger and block all but all same results

I did it same as working static mesh :

Sorry, I meant expand Collision Presets (little arrow to left). Thanks!

Hey

Check your Skeletal Mesh and see if it has a Physics Asset on it. I can reproduce this if Skeletal Mesh doesn’t have one. Imported Skeletal Meshes have one by default, but if you don’t have one, you can create one for mesh by right-clicking on it in Content Browser and selecting Create > Create Physics Asset. You can more about Physics Assets here, if you need to make adjustments:

https://docs.unrealengine.com/latest/INT/Engine/Physics/PhAT/UserGuide/index.html

When you do a trace (or OnClick, which is a raycast as well) it traces against both simple and complex collision. Static Meshes by default have complex collision, while Skeletal Meshes do not. Adding a Physics Asset takes care of that.

Hope that helps!

It Worked!! , Thanks so much for your Help :slight_smile:

Hi, I have similar problem but creating a physical asset didnt solve.
I tried several collision modes and editing asset/adding box or sphere collision objects, without success.
difference is between this and my case, Im using C++ and manually creating a pawn and attaching skeletal mesh/physical asset (SetPhysicsAsset for skeletal mesh object)
Im using ReceiveActorOnClicked method in C++ which works fine with static meshes.

We’ll probably need to see code you’re using to attach physical asset. Thanks!

hello, code fragment in my pawn constructor:

static ConstructorHelpers::FObjectFinder<USkeletalMesh> UnitMesh(TEXT("SkeletalMesh'/Game/Units/soldier_animated.soldier_animated'"));
static ConstructorHelpers::FObjectFinder<UPhysicsAsset> Physics(TEXT("PhysicsAsset'/Game/Units/soldier_animated_Physics2.soldier_animated_Physics2'"));

_pUnitMesh = PCIP.CreateDefaultSubobject < USkeletalMeshComponent >(this, TEXT("Unit"));
	_pUnitMesh->SetSkeletalMesh(UnitMesh.Object);
	_pUnitMesh->SetPhysicsAsset(Physics.Object);
SetRootComponent(_pUnitMesh);

physics asset I tried to generate in many versions (with different collision parameters like box, sphere, manually added new box/sphere, nothing worked)

tried without SetPhysicsAsset as I noticed that GetPhysicsAsset returned with valid object if I just create skeletal mesh from BP (where it has already physics asset linked - but neither worked)

actually Im using a fake hidden static mesh covering skeletal mesh to getting click, but that it isnt nicest method :slight_smile:

Hey BigaC-

Can you explain exactly what your problem is? Are you saying that OnClicked events aren’t working for your skeletal meshes? Can you show entire class that you’re creating your skeletal mesh in as well as how your OnClicked event is setup?

Cheers

My problem is that no mouse event works on skeletal component even it has physics asset.

I tried 2 methods:

  • using actor’s ReceiveActorOnClicked internal method:
  • adding OnClick dynamically

virtual void ReceiveActorOnClicked() override;
or
pUnitMesh->OnClicked.AddDynamic(this,&AWorldUnit::OnClick);

both works for static components, but neither for skeletal…

code is too big to insert here, do I send you via email?

You should be able to code files and post as an attachment. If that doesn’t work you can upload files to dropbox and then send me a message on forums with a link to download them.