Announcement

Collapse
No announcement yet.

Change Component properties dynamically?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Change Component properties dynamically?

    Hi!

    I have a little problem with a volume..

    I want to set the collision on when a Player from one team touch it! This is my code inside my custom volume class..

    Code:
    event Touch( Actor Other, PrimitiveComponent OtherComp, vector HitLocation, vector HitNormal )
    {
    
    local brushcomponent brushcomponent0;
    local int TeamNum;
    local Pawn P;
    
    
    	P=pawn(other);
    	TeamNum=p.GetTeam().TeamIndex ;
    	
    	if (TeamNum == 0)
    		{
    		BrushComponent0 = new(self)  class'BrushComponent';
    		BrushComponent0.BlockActors=true;
    		BrushComponent0.BlockZeroExtent=true;
    		BrushComponent0.BlockNonZeroExtent=true;
    		BrushComponent0.BlockRigidBody=true;
    		AttachComponent(BrushComponent0);
    		ClientMessage('BLOCK RED TEAM');
    		}
                 else if (TeamNum == 1)
                         {
                               //more stuff like blockactors = false for blue team.. etc..
                         }
    	}
    ok.. but i get errors like ""blockActors const values can't be changed" o stuff like that.. so my question is, How do I change the "blockActors" properties dynamically inside my BrushComponent0?

    I'm reading the UDN every day without success ... so I'll be very grateful if someone can give a hand with this!

    Thanks! and sorry for my bad English!

    #2
    You cannot set const properties directly,

    You must use functions provided in the PrimitiveComponent Base Class instead.

    Brush extends primitive component.

    Primitive Component Functions
    Here is list of all primitive component functions


    Set Actor Collision
    Notice how one of these functions is SetActorCollision.


    This modifies the const properties for you, controlling both BlockActors and CollideActors in one function


    SetBlockRigidBody
    Another one related to your post is SetBlockRigidBody


    More Collision Variable Setting Functions

    NotifyRigidBodyCollision
    SetNotifyRigidBodyCollision

    SetRBCollidesWithChannel
    SetRBCollidesWithChannel

    SetRBChannel
    SetRBChannel

    Traces (nonzeroextent and zero extent)
    SetTraceBlocking

    you can call these functions any time during gameplay!




    Rama

    Comment


      #3
      Nice! Thanks a lot ! I don't get any errors now! But my volume only blocks rigid body.. but it's ok! I'll try to make it work! thanks Evernewjoy! Your help was so useful! I'll research a little be more about this! And Thanks for the links!

      Comment

      Working...
      X