Announcement

Collapse
No announcement yet.

Change weapon FOV

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

    Change weapon FOV

    Hi there,

    I have created a weaponbase and a weapon that extends said weaponbase.
    I'd like to create a function SetFOV(byte FOV) inside the weaponbase that changes the FOV of the FirstPersonMesh.
    I've been trying various things, none have proven successful.

    This does not work:
    Code:
    simulated function SetFOV(byte FOVToSet)
    {
    	local UTWeapon WC;
    	WC = UTWeapon();
    
    	WC.FOV = FOVToSet;
    }
    The FOV is defined in the DefaultProperties of the weapon (not the WeaponBase).
    Is there a way to access the FOV from inside the WeaponBase?

    Thanks guys!

    #2
    You have to change the FOV for the MESH (Hint: class SkeletalMeshComponent.uc) not the Weapon.

    Comment


      #3
      Originally posted by jeffhuys View Post
      ...
      Code:
      simulated function SetFOV(byte FOVToSet)
      {
      	local UTWeapon WC;
      	WC = UTWeapon(); <= What weapon?
      	WC.FOV = FOVToSet;
      }
      ...
      Try 'WC = UTWeapon(SomeWeapon);' - where 'SomeWeapon' is your weapon or 'Self' if self is a weapon

      Comment


        #4
        When I try "self" it tells me that it's "unnecessary". But I want to call it from TCWeaponBase.uc and I want it to work with TCWeap_ShockRifle.uc

        Comment


          #5
          If TCWeaponBase extends UTWeapon then the cast is indeed unnecessary.
          Casting is only required in "one direction".

          Comment


            #6
            Originally posted by jeffhuys View Post
            When I try "self" it tells me that it's "unnecessary". But I want to call it from TCWeaponBase.uc and I want it to work with TCWeap_ShockRifle.uc
            If function SetFOV is in your base weapon class then use only FOV = FOVToSet; and to call from other places you need use filter like YourBaseWeapon(SomeWeapon).SetFOV(FOVToSet);.
            Probably UnrealEverything has right... You need call Mesh.SetFOV(FOVToSet);.
            Self - if you call static function...

            Comment

            Working...
            X