Announcement

Collapse
No announcement yet.

Only show emitter in first person view

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

    Only show emitter in first person view

    Working on a weapon at the moment and it has an emitter based flash (as opposed to xEmitter). The problem is I only want it to show in the first person view. I spawn a seperate emitter for the third person view so it comes out of the correct place on the gun but at the moment both emitters can be seen from a 3rd person view. One shows in the correct place (at the end of the gun) but the other appears in the centre of the pawn.

    #2
    Its seperate code, they shouldnt both be happening at once unless you messed something way up. The first person actor is only visible when in third person (that it, it has bOnlyDrawIfAttached=true and is attached to the third person model), and the first person muzzle flash is drawn only from the RenderOverlays function, which is only called in first person.

    Comment


      #3
      Well the code I have to use an emitter instead of an xEmitter is basically the same, almost just copied the code an deleted the x (there were a few other differences, such as the emitter isn't spawned until it first flashes). So is it to do with bOnlyDrawIfAttached? The emitter is attached to the weapon but it still shows in third person. By 3rd person I mean the 3rd person camera, not another player looking at them.

      Comment


        #4
        Still having problems with this. My code really is almost identical to the code that's already there, so if my code is wrong, then so is the code in the game already.

        From what I can figure out, the flash emitters (or xemitters), are automatically drawn onto the canvas if they are attached to the weapon. That is the case with the weapon I am working on. The flash is only explicitly drawn onto the canvas when there is no attachment bone specified.

        here is my code relating to the drawing of the emitter

        Code:
        function DrawMuzzleFlash(Canvas Canvas)
        {
            // Draw smoke first
            if (SmokeEmitter != None && SmokeEmitter.Base != Weapon)
            {
                SmokeEmitter.SetLocation( Weapon.GetEffectStart() );
                Canvas.DrawActor( SmokeEmitter, false, false, Weapon.DisplayFOV );
            }
        
            if (gFlashEmitter != None && gFlashEmitter.Base != Weapon)
            {
                gFlashEmitter.SetLocation( Weapon.GetEffectStart() );
                Canvas.DrawActor( gFlashEmitter, false, false, Weapon.DisplayFOV );
            }
        }
        You should notice it's the exact same as the base function except the FlashEmitter property has been replaces with gFlashEmitter which is an emitter rather than an xemitter.

        I'm going about this in the way that it's done for the assault rifle because after spawning the emitter, I attach it to a bone on the weapon's mesh. According to this code the emitter doesn't need to be explicitly drawn (note this condition: gFlashEmitter.Base != Weapon) which works fine for the assault rifle.

        For now we can just ignore the third person flash effect, there isn't really a problem with that. I just need to stop the first person effect showing up in third person.

        Comment


          #5
          Time for an experiment. Disable the code that draws the effect in first person. See if the emitter shows up still in first person. If not, good. Then see if it still shows up in third person. If so, bad.

          If it shows up in third person, the first person draw call isnt whats causing it to draw, but probably is related to the problem we mentioned earlier about only drawing while attached. Try replacing with a standard emitter (just any old emitter will do), and repeat.

          That should lead you in the right direction, though I dont know the true cause.

          Comment


            #6
            Even with the DrawMuzzleFlash function completely blank the exact same thing happens. Tried it with a standard emitter the same thing happens.

            Comment

            Working...
            X