My problem is so far the KActor does not appear to actually be constrained in any way. I can tell the KActor is being effected because a separate line moves it into place in front of the players face but then it just drops back down and does nothing. Can someone point out what I am doing wrong? Thanks in advance!
Relevant code below:
//Excerpt from Pawn
Code:
class Mirror_Pawn extends UDKPawn; var RB_ConstraintActorSpawnable Hand; event UpdateEyeHeight(float DeltaTime) { Hand.SetRotation(Controller.Rotation); Hand.SetRelativeLocation(Controller.RelativeLocation + vect(128, 0, 16)); } function PostBeginPlay() { Hand = Spawn(class'RB_ConstraintActorSpawnable', self); Hand.ConstraintActor2 = self; Hand.SetBase(self); Hand.ConstraintSetup.LinearXSetup.bLimited = 1; Hand.ConstraintSetup.LinearXSetup.LimitSize = 0; Hand.ConstraintSetup.bLinearLimitSoft = true; Hand.ConstraintSetup.LinearLimitStiffness = 128; Hand.ConstraintSetup.LinearLimitDamping = 0; Hand.ConstraintSetup.LinearYSetup.bLimited = 1; Hand.ConstraintSetup.LinearYSetup.LimitSize = 0; Hand.ConstraintSetup.bLinearLimitSoft = true; Hand.ConstraintSetup.LinearLimitStiffness = 128; Hand.ConstraintSetup.LinearLimitDamping = 0; Hand.ConstraintSetup.LinearZSetup.bLimited = 1; Hand.ConstraintSetup.LinearZSetup.LimitSize = 0; Hand.ConstraintSetup.bLinearLimitSoft = true; Hand.ConstraintSetup.LinearLimitStiffness = 128; Hand.ConstraintSetup.LinearLimitDamping = 0; super.PostBeginPlay(); MC = Mirror_Controller(Controller); }
Code:
class Mirror_Controller extends UDKPlayerController; var KActor Holding; exec function use() { local vector loc, norm, end, start; local TraceHitInfo hitInfo; local rotator outrot; local Actor traceHit; local Kactor pickup; //Drop whatever we are holding if(Holding != none) { //Holding.SetBase(none); //Holding.SetPhysics(PHYS_RigidBody); Mirror_Pawn(pawn).Hand.ConstraintActor1 = none; Holding = none; ClientMessage("Dropped Kactor"); return; } //Cast ray from player eyes GetActorEyesViewPoint( start, outrot ); end = start + normal(vector(Rotation))*256; traceHit = trace(loc, norm, end, start, true,, hitInfo); //TODO Debuging shoudl be removed DrawDebugLine(start, end, 80, 9, 28, true); if (traceHit == none) { ClientMessage("Nothing found, try again."); super.Use(); return; } pickup = Kactor(traceHit); if(pickup == none) { ClientMessage("Hit = " $ traceHit); ClientMessage("this is not a Kactor, try again."); super.Use(); return; } ClientMessage("Hit = " $ traceHit); ClientMessage("THIS IS A KACTOR! (or I am an idiot and cant understand what I am looking at)"); Holding = pickup; //Holding.SetLocation(Mirror_Pawn(pawn).Hand.location); Holding.CollisionComponent.SetRBPosition( Mirror_Pawn(pawn).Hand.location ); //Holding.SetBase(Mirror_Pawn(pawn).Hand); Mirror_Pawn(pawn).Hand.ConstraintActor1 = Holding; ClientMessage("Attempted to pick up KActor"); }