I have little experience with Physical Materials, but it doesn’t sound hard.For a small test i did:
1.final rigged object
2.the object has a finished physics asset .
3.while still in the PhAT editor, i selected each of the created collision boxes and on the right in ‘‘phys material’’ i have imported a physical material
4.The physical material was created as standard (right mouse button> new physical material and it the properties of that physical material i have ‘‘impact threshold’’ set to 3 and in ‘‘impact effect’’ i have a particle effect plugged in.
Now in theory if i drag that physics asset (KAsset) on the map and shoot it with the link gun, the particle should play on the place where it was hit by the projectile.But no particle is spawning/ playing… Am i using right the Physical Material?
Missing a step perhaps?
I never used it, but I think you need to read the physical material when hit the object, then get the particle from the material and then spawn the particle.
In the same way that the footstep sounds reads the physical material from the ground and then you play the sound / spawn the particle.
Although I think Kactor already had something that doing it automatically.
personally I never could get the PhysicalMaterial’s built-in impact effects to work, and added code to manually spawn such particles on my own KActor’s RigidBodyCollision event
but I guess I can take a look at the native code and see if they actually do anything and how to trigger them
it appears the physical material’s impact and slide effects are only used on KActor and FracturedStaticMeshActor - for everything else you’ll have to do it manually
It is as default in landscape functionality like if you trace down you can check what kind of surface you have " differentiate between layers ". Instance sand snow river ground…
In UDK → UDKInstall-2015-02.
Thank you for commenting guys.I did some research as the info on this for some reason is really scares.Now i do have the unreal engine 3 editor that comes with Killing Floor 2 and Painkiller hell and damnation to see what was going on.In their editors i just drag and dropped a physics asset in the level(a character)(this is labeled as a KAsset and i suppose it is the same as KActor?) and when i shoot it, blood particle spawns from every weapon hit angle.
In the Physical material that was applied to the physics asset, the only difference i could spot in relation to udk is that it has in ‘‘Physical Material Property’’ their own custom property.In udk we only have ‘‘UTphysicalMaterialProperty’’ which does nothing.
So…i have to open/extend the UTphysicalMaterialProperty.uc and in default properties make it accept particles or something??
All other options of the physical material like friction,density etc work.Only the Impact Effect and Impact sound look disabled or not implemented.
I wish the old forums get back soon as this is most probably solved there and just waiting for copy and paste :rolleyes:
if it works on the Killing Floor 2 or Painkiller editor but not on UDK, chances are they added extra functionality into their KAsset native code that does not exist in the vanilla UE3 native code
KAsset and KActor are entirely different classes (even if they are for physical actors). again, from checking the native code only the KActor and FracturedStaticMeshActor classes are using the ImpactEffect, SlideEffect, ImpactSound and SlideSound properties.
so anything beyond that you’ll have to add manually, a PhysicalMaterialProperty won’t help you with this.
in short, the flow goes like this for the KActor:
on PostBeginPlay it calls SetPhysicalCollisionProperties(), which checks the PhysicalMaterial and spawns two particle components: one for ImpactEffectInfo.Effect and one for SlideEffectInfo.Effect, and two audio components: one for ImpactEffectInfo.Sound and one for SlideEffectInfo.Sound. all 4 components are detached and disabled. all of this happens on UnrealScript so you can see the code.
when a rigidbody collision occurs, if notifyrigidbodycollision is enabled, the even OnRigidBodyCollision is called. the native part of this code compares the ImpactVelocity with the impact threshold, and the SlideVelocity with the slide threshold, and makes sure enough time has passed since the last impact, and it attaches and activates these components as needed.
you can either follow the flow as is, or for particles you can always spawn them via the world emitter pool. but the point is you just need to get the particle from the physical material and then spawn it on the OnRigidBodyCollision event of your actor based on some calculations
Thank you . I will dig in the killing floor scripts to see what is happening there.(by the way, the painkiller editor doesn’t provide the src folder which is a bummer)
A question.I dragged a barrel kactor on to the level and gave it a physical material override.Impact threshold is 0(tried with 1) and in Impact effect I placed a particle.The Kactor has also bNotifyRigidBodyCollision set to true.So the physical material now works as you said.But i noticed that it spawn the particle only on collision of the barrel> when the barrel is falling to the ground or dragged and dropped with the physics gun.Weapons fire don’t trigger the particle of the physical material.Only collision hitting.Is that how it is supposed to work?