Results 1 to 4 of 4
  1. #1
    MSgt. Shooter Person
    Join Date
    May 2011
    Location
    Austrailia
    Posts
    42

    Default Kactorspawnable pushing physics. :o

    Hey guys,

    I have a pawn which has a couple of sockets in its mesh which i have attached a set of kactorspawnalbes too. The Idea is when you shoot the kactor it falls of the pawn, this part works. However what im am having an issues is that after the kactor has detached from the pawn i can't push it with my pawn like i would a normal kactor i place in editor. Ive been trolling the net looking for awnsers but all i can seem to find is "i've solved it thanks guys !", never an explanation .

    I'm using the same static mesh as i do for my kactors in the editor and i can push them around no problem.
    I have set a physics scale.
    I have set a collision on the mesh in the editor.


    Pushing Pawn Code
    Code:
    	bPushesRigidBodies=true
    	RBPushStrength = 200.0;
    Pawn with actors attached Code
    Code:
    class StationaryPawn extends UTPawn placeable;
    	
    	var TurretController MyController;
    	var float Speed;
    
    	var SkeletalMeshComponent MyMesh;
    	var bool bplayed;
    	var Name AnimSetName;
    	var AnimNodeSequence MyAnimPlayControl;
    	
    	var () float attackrange;
    	var () float perceptionDistance;
    	var () float hearingDistance;
    	var Syn_ModularPawn_Spike Spike1,Spike2,Spike3,Spike4;
    	var Synergy2_MovableObject Sphere;
    	var Vector SocketLocation;
    	var Rotator SocketRotation;
    
    	
    defaultproperties
    {
    
    Begin Object Class=SkeletalMeshComponent Name=InitialSkeletalMesh
    			CastShadow=true
    			bCastDynamicShadow=true
    			bOwnerNoSee=false
    			LightEnvironment=MyLightEnvironment;
    			BlockRigidBody=true;
    			CollideActors=true;
    			BlockZeroExtent=true;
    			HiddenGame=true;
    			SkeletalMesh=SkeletalMesh'SynergyTest.SkeletalMesh.Test'
    	End Object
    
    	Mesh=InitialSkeletalMesh;
    	Components.Add(InitialSkeletalMesh);
    }
    
    function TurretController GetController(){
    	return MyController;
    }
    
    
    
    
    simulated function PostBeginPlay()
    {
    	if (Mesh != None)
    	{
    	  if (Mesh.GetSocketByName('Right Arm') != None)
    	  {
    		Mesh.GetSocketWorldLocationAndRotation('Right Arm', SocketLocation, SocketRotation);
    
    		Spike1 = Spawn(class'Syn_ModularPawn_Spike',,, SocketLocation, SocketRotation);
    		
    		if (Spike1 != None)
    		{
    		  Spike1.SetBase(self,, Mesh, 'Right Arm');
    		  Spike1.ForceNetRelevant();
    		  Spike1.bNetDirty = true;
    		}
    	  }
    	  if (Mesh.GetSocketByName('Left Arm') != None)
    	  {
    		Mesh.GetSocketWorldLocationAndRotation('Left Arm', SocketLocation, SocketRotation);
    
    		Spike2 = Spawn(class'Syn_ModularPawn_Spike',,, SocketLocation, SocketRotation);
    		
    		if (Spike2 != None)
    		{
    		  Spike2.SetBase(self,, Mesh, 'Left Arm');
    		  Spike2.ForceNetRelevant();
    		  Spike2.bNetDirty = true;
    		}
    	  }
    	  if (Mesh.GetSocketByName('FrontArm') != None)
    	  {
    		Mesh.GetSocketWorldLocationAndRotation('FrontArm', SocketLocation, SocketRotation);
    
    		Spike3 = Spawn(class'Syn_ModularPawn_Spike',,, SocketLocation, SocketRotation);
    		
    		if (Spike3 != None)
    		{
    		  Spike3.SetBase(self,, Mesh, 'FrontArm');
    		  Spike3.ForceNetRelevant();
    		  Spike3.bNetDirty = true;
    		}
    	  }
    	  if (Mesh.GetSocketByName('BackArm') != None)
    	  {
    		Mesh.GetSocketWorldLocationAndRotation('BackArm', SocketLocation, SocketRotation);
    
    		Spike4 = Spawn(class'Syn_ModularPawn_Spike',,, SocketLocation, SocketRotation);
    		
    		if (Spike4 != None)
    		{
    		  Spike4.SetBase(self,, Mesh, 'BackArm');
    		  Spike4.ForceNetRelevant();
    		  Spike4.bNetDirty = true;
    		}
    	  }
    	   if (Mesh.GetSocketByName('Middle') != None)
    	  {
    		Mesh.GetSocketWorldLocationAndRotation('Middle', SocketLocation, SocketRotation);
    
    		Sphere = Spawn(class'Synergy2_MovableObject',,, SocketLocation, SocketRotation);
    		
    		if (Sphere != None)
    		{
    		  Sphere.SetBase(self,, Mesh, 'Middle');
    		  Sphere.ForceNetRelevant();
    		  Sphere.bNetDirty = true;
    		}
    	  }
    	}
    
    
    	super.PostBeginPlay();
    	SetPhysics(PHYS_Walking);
    	if (MyController == none)
    	{
    		MyController = Spawn(class'TurretController', self);
    		MyController.SetPawn(self);		
    	}
    }

    KactorSpawnable Code

    Code:
    class Syn_ModularPawn_Spike extends KActorSpawnable;
    	var Float Hp;
    	var int d;
    
    Simulated Event TakeDamage(int DamageAmount, Controller EventInstigator, vector HitLocation, vector Momentum, class<DamageType> DamageType, optional TraceHitInfo HitInfo, optional Actor DamageCauser)
    {
    	Super.TakeDamage(DamageAmount,EventInstigator,HitLocation,Momentum,DamageType,HitInfo,DamageCauser);
    	Hp = Hp-DamageAmount;
    	`log(Hp);
    	if(Hp < 0 ) {
    		self.SetBase(none);
    		self.SetPhysics(PHYS_Falling);
    		self.SetPhysics(PHYS_RigidBody);
    		
    	}
    }
    
    defaultproperties
    {
    	bMovable = true;
    	bCanStepUpOn = false
    	bProjTarget=true
    	bCollideActors=true
    	bCollideWorld=true
    	bHardAttach=true
    	Hp = 10;
    	
    	Begin Object Class=StaticMeshComponent Name=RollerSpike
    		StaticMesh=StaticMesh'SynergyTest.RollerSpike'
    		bNotifyRigidBodyCollision=true
    	
    		HiddenGame=FALSE 
    		ScriptRigidBodyCollisionThreshold=0.001 
    		LightingChannels=(Dynamic=TRUE) 
    		BlockRigidBody=true
    		RBChannel=RBCC_GameplayPhysics
    		RBCollideWithChannels=(Default=TRUE,BlockingVolume=TRUE,GameplayPhysics=TRUE,EffectPhysics=TRUE)
    		bCollideActors = true
    		bCollideWorld = true
    		bBlockActors = true
    
    	End Object
    	CollisionComponent=RollerSpike
    	Components.Add(RollerSpike)
    	bDamageAppliesImpulse = false;
    }
    Any Ideas Would be Wikid
    Check out Synergy Made in udk !

  2. #2
    MSgt. Shooter Person
    Join Date
    May 2011
    Location
    Austrailia
    Posts
    42

    Default

    Bumping for coding justice!
    Check out Synergy Made in udk !

  3. #3
    MSgt. Shooter Person
    Join Date
    Aug 2010
    Posts
    196

    Default

    You can use the Bump function.

    Code:
    simulated function Bump(Actor Other, PrimitiveComponent OtherComp, Vector HitNormal)
    {
    
            //Add your code here e.g.
    	WorldInfo.Game.Broadcast(self, "Bumped", );
            if(YourPawn(Other)!=none)
            ApplyImpulse(MomentumVect,
    					DamageType.default.KDamageImpulse,
    					self.Location - Other.Location,
    					,//HitInfo,
    					DamageType);
    
            //etc
    	super.Bump(Other, OtherComp, HitNormal);
    }

  4. #4
    MSgt. Shooter Person
    Join Date
    May 2011
    Location
    Austrailia
    Posts
    42

    Default

    Thanks for the reply i will give it a try and report back.
    Check out Synergy Made in udk !


 

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.