Results 1 to 4 of 4
  1. #1

    Default KActor with Multiple Actor Components?

    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:

    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);
    }
    What am I doing wrong? And is this even possible?
    Try my game Never End, now on the App Store! For more info, see the release thread.

    My Blog: WillyG Productions - Your Premiere UDK Resource
    My YouTube Channel: WillyG Productions
    My Facebook Page: WillyG Productions

  2. #2

    Default

    An image to show the problem:

    Collision problem.jpg

    The L-block on the right should have collision around all its individual cube pieces (indicated by the white bounding box), but only the original StaticMeshComponent has it.
    Try my game Never End, now on the App Store! For more info, see the release thread.

    My Blog: WillyG Productions - Your Premiere UDK Resource
    My YouTube Channel: WillyG Productions
    My Facebook Page: WillyG Productions

  3. #3
    MSgt. Shooter Person
    Join Date
    Jul 2010
    Location
    Vect(0,0,0);
    Posts
    129

    Default

    I have exactly same problem)
    I dunno, maybe there is a way to make collision with volumes? If they support Add/Subtract/Intersect operations in runtime, it would be perfect.

  4. #4

    Default

    That would be, except I'm pretty sure volumes don't support rigid body collisions like a kactor does. I'm starting to think this is not possible...
    Try my game Never End, now on the App Store! For more info, see the release thread.

    My Blog: WillyG Productions - Your Premiere UDK Resource
    My YouTube Channel: WillyG Productions
    My Facebook Page: WillyG Productions


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.