Download

Physical Material from FHitResult is null

Hi!

Im trying to get Physical Material from a FHitResult reference when my projectile impacts. I have assigned a delegate to my movement component



	TScriptDelegate<FWeakObjectPtr> StopDelegate;
	StopDelegate.BindUFunction(this, FName("OnHit"));

	MovementComp->OnProjectileStop.Add(StopDelegate);


The delegate is working properly and the function onHit receives only one FHitResult param:



void AProjectile::OnHit(const FHitResult& Hit)


Inside that function I’m trying to get the physic material from the FHitResult param like this:



	UPhysicalMaterial* HitPhysMat = Hit.PhysMaterial.Get();


But HitPhysMat pointer is always null.

I’m pretty sure that the material which the projectile is impacting has a physic material assigned.

Any idea??

Thanks

In the projectile collision volume you should tick the option called bReturnMaterialOnMove (i think is what it’s called).

Hi Dec1234!

So easy?? hehehehe I can’t try now but I will check it later at home.

Thanks so much!!!