Results 1 to 3 of 3
  1. #1
    Iron Guard
    Join Date
    Jan 2012
    Posts
    623

    Default Who deleted my arrow? Issues on reuse of the projectile.

    To avoid a lot of spawns that are expensive i made a bow that reuses always the same arrow, setting it to hidden/not hidden and setting the location to the muzzleflashsocket every time the archer fires.
    The problem is that sometimes the arrow doesn't appear. It works for a lot of shots, then it doesn't work for some (5/10) other and then it works again.

    I made some tests and the result are:

    - the arrow isn't none, it exists, i have and if statement that recreates the arrow if it is destroyed in some way
    - the arrow isn't hidden
    - the arrow coordinates seems to be corrects, i log the coordinates and the visible shots have same coordinates than the issued shots if the pawn doesn't move

    i tried to set the location to the pawn insted of the muzzle flash socket to see if there could be problem with the position of the socket but the behavior is the same.

    This is the code that simulate the spawn of the arrow:

    Code:
            local vector StartTrace, RealStartLoc, AimDir;
    
    	// This is where we would start an instant trace. (what CalcWeaponFire uses)
    	StartTrace = Instigator.GetWeaponStartTraceLocation();
    	AimDir = Vector(GetAdjustedAim( StartTrace ));
    
    	RealStartLoc = GetPhysicalFireStartLoc(AimDir);
    
    	if(Arrow == none)
    	{
    		`log("SPAWN NEW ARROW");
    		Arrow = Spawn(class'MyProjectile', Self,, RealStartLoc);
    	}
    
    	Arrow.SetLocation(RealStartLoc);
    	
    	//SIMULATE SPAWN
    	Arrow.SetHidden(FALSE);
    	//reset the collision of the arrow
    	Arrow.SetCollision( true, false );
    
    	//input movement
    	if( Arrow != None )
    	{
    		Arrow.Init( AimDir );
    	}
    Edit:
    if(Arrow == none && bDeleteMe == TRUE)
    {
    `log("SPAWN NEW ARROW");
    Arrow = Spawn(class'MyProjectile', Self,, RealStartLoc);
    }
    seams to solve the problem. I need to understand who set the deletion of the arrow and override that function.
    Last edited by Ivan84; 07-09-2012 at 01:13 PM.

  2. #2
    MSgt. Shooter Person
    Join Date
    Jul 2011
    Posts
    91

    Default

    Out of world maybe delete an Actor!

  3. #3
    Iron Guard
    Join Date
    Jan 2012
    Posts
    623

    Default

    EDIT

    Found it, this are the Actor's functions that make the arrow disappear:

    /** called when the actor falls out of the world 'safely' (below KillZ and such) */
    simulated event FellOutOfWorld(class<DamageType> dmgType)
    {
    SetPhysics(PHYS_None);
    SetHidden(True);
    SetCollision(false,false);
    Destroy();
    }

    /** called when the Actor is outside the hard limit on world bounds
    * @note physics and collision are automatically turned off after calling this function
    */
    simulated event OutsideWorldBounds()
    {
    Destroy();
    }


    but i think i can leave the code as it is and respawn the arrow in the unlikely event that it flies out of bounds.
    Last edited by Ivan84; 07-10-2012 at 10:56 AM.


 

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.