Thanks Saishy, reading the projectile code, seems the fractured mesh collision is applied with the HitWall Event, correct me if am wrong, I noticed that basically what I need is to convert the HitStaticMesh to a class'KActorFromStatic' and then call the TakeDamage on it, could someone explain if it is possible how to achieve that from a fractured mesh? For the below code, I fail to get a valid StaticMeshComponent from the hit info, but also having a valid StaticMeshComponent returns a false for the HitStaticMesh.CanBecomeDynamic(), by ignoring the condition, it will only produce None warning access for this NewKActor entity
Code:
NewKActor = class'KActorFromStatic'.Static.MakeDynamic(HitStaticMesh);
This is the whole function.
Code:
Class MeleeWeapon extends Weapon;
function TraceSwing()
{
local Actor HitActor;
local Vector HitLoc, HitNorm;
local KActorFromStatic NewKActor;
local StaticMeshComponent HitStaticMesh;
local TraceHitInfo MyHitInfo;
// gather HitInfo fom the HitActor
foreach CollidingActors(class'Actor', HitActor, 1.0, HitLoc, true,,MyHitInfo )
{
HitStaticMesh = StaticMeshComponent(MyHitInfo.HitComponent);
if ( (HitStaticMesh != None) && HitStaticMesh.CanBecomeDynamic() )
{
NewKActor = class'KActorFromStatic'.Static.MakeDynamic(HitStaticMesh);
NewKActor.TakeDamage( 10000.0, Instigator.Controller, HitLoc, Momentum, class'DamageType',, self);
}
}
}
simulated state Swinging extends WeaponFiring
{
simulated event Tick(float DeltaTime)
{
super.Tick(DeltaTime);
TraceSwing();
}
simulated event EndState(Name NextStateName)
{
super.EndState(NextStateName);
}
}
Bookmarks