Results 1 to 2 of 2

Thread: constraints

  1. #1

    Default constraints

    Hi, i'm trying to figure out how constraints work in UDK. Have looked arround for a few days about attaching a kactor to my pawn, but what i find is mostly kismet, which i prefer to avoid by this moment.

    Then i found refferences to rb_constraints and its familly, but not much about using them on US. Finally i found this:
    http://udn.epicgames.com/Three/Whizz...nDocument.html

    It seems simple enought, so i tried to use that example and make my code. This is the result:
    Code:
    // Spawn the Constraint
       CharacterConstraint = Spawn(class'RB_ConstraintActorSpawnable',self,,pawn.Location);
       // Don't allow any twisting around, we will handle rotation manually later on if we want the character to rotate while moving
       CharacterConstraint.ConstraintSetup.bSwingLimited = true; 
       CharacterConstraint.ConstraintSetup.bTwistLimited = true;
       // Initialize the constraint between the character and the AquaBall on the bone 'b_Head' 
        CharacterConstraint.InitConstraint(Pawn,GlossPawn(pawn).ultimoHit,'b_Head'); //tried also with the gun socket
    Well, ultimoHit is my Custom Kactor wich is, simply a box:

    Code:
    class kActorBase extends KActorSpawnable
    	placeable;
    
    var() int Health;
    
    event TakeDamage(int Damage, Controller EventInstigator, Vector HitLocation, Vector Momentum, class<DamageType> DamageType, optional TraceHitInfo HitInfo, optional Actor DamageCauser){
    	local int i;
    	super.TakeDamage(Damage,EventInstigator,HitLocation,Momentum,DamageType,HitInfo,DamageCauser);
    	Health=Health-Damage;
        if (Health<=0)
        {
    	    for(i=0; i<20; i++)
    	    {   
    	    	Spawn(class'fragment', , ,HitLocation); 
    	    }
    	    Destroy();
                //For frame of reference, these are simply KActors that have had a mesh component pre-selected in script and are pre-set to awake on start.
        }
    }
    
    DefaultProperties
    {
    	begin object name=StaticMeshComponent0
            StaticMesh=StaticMesh'LT_Mech.SM.Mesh.S_LT_Mech_SM_Cratebox02a'
        end object
    	Components.Add(StaticMeshComponent0)
        Health = 100
    	bDamageAppliesImpulse=false
    	bNoDelete = false
    	bWakeOnLevelStart=true
    	bCollideWorld=true
    
    }
    but when i call the function, the box randomly flyes on any direction pretty fast. If you can touch it again and launch the grab function, it agains go away flying in other direcion or simply dissapears. Cant understand whats happening here.
    ¿Any idea on this? Is there any scripting refferences to go a little deeper into understanding US way of constraints?

    Thanks

  2. #2

    Default

    What could be happening with the random flying around is the KActor and Pawn have overlapping collisions. They are trying to resolve their collision by separating from each other, but you've constrained them together so they do a little "dance" instead. Eventually given enough prodding the KActor can just fly off and disappear.

    As for reference, unfortunately Whizzle's really the best out there. If you've got a specific thing you want to do just explain it and someone on here can try to help out.
    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.