I have a custom class extended from KActorSpawnable that handles spawning actors of various shapes at runtime. Each actor looks something like a Tetris block (made up of StaticMeshComponents, each of which is a cube, and each of which is also spawned at runtime). Since I plan to have many such actors with many different shapes, the system needs to be coded dynamically like this.
My problem is, only the original StaticMeshComponent (the one defined in DynamicSMActor) receives rigid body collision. All the other dynamically spawned components act with no collision and pass through walls, the player, etc. What I want is to have each component have rigid body collision, so that the entire block behaves like a single unified rigid body shape.
My dynamic spawning code:
What am I doing wrong? And is this even possible?Code:simulated event PostBeginPlay() { local int i; local StaticMeshComponent SMC; local LightingChannelContainer LCC; super.PostBeginPlay(); LCC.Dynamic = true; for(i = 0; i < Blocks.Length; i++) { // LOOKS SMC = new class'StaticMeshComponent'; SMC.SetStaticMesh(StaticMesh'Never_End_MAssets.Cube'); SMC.SetScale(0.25); SMC.SetHidden(false); SMC.SetTranslation(64 * Blocks[i]); SMC.SetMaterial(0,BallMaterial); SMC.SetMaterial(1,BallMaterial); // LIGHTING SMC.SetLightingChannels(LCC); SMC.SetLightEnvironment(LightEnvironment); // RIGID BODY SMC.InitRBPhys(); SMC.SetNotifyRigidBodyCollision(true); SMC.ScriptRigidBodyCollisionThreshold = 0.001; SMC.SetBlockRigidBody(true); SMC.SetRBChannel(RBCC_GameplayPhysics); SMC.SetRBCollidesWithChannel(RBCC_Default, true); SMC.SetRBCollidesWithChannel(RBCC_BlockingVolume, true); SMC.SetRBCollidesWithChannel(RBCC_GameplayPhysics, true); SMC.SetRBCollidesWithChannel(RBCC_EffectPhysics, true); SMC.WakeRigidBody(); AttachComponent(SMC); } StaticMeshComponent.SetMaterial(0,BallMaterial); StaticMeshComponent.SetMaterial(1,BallMaterial); }



Reply With Quote

Bookmarks