Page 1 of 2

DesiredFOV makes Weapon disappear.

Posted: Sun Apr 24, 2016 10:19 pm
by UTX
You know how when you zoom in the Sniper Rifle, it disappears, even when you zoom in to 1.1? Is there a way to avoid this? I was making a weapon with a simulated iron sight so it would zoom in only a little bit but I want to keep the weapon visible, that's what makes it an iron sight.

Re: DesiredFOV makes Weapon disappear.

Posted: Sun Apr 24, 2016 10:45 pm
by papercoffee
Maybe you should look into the code of the Infiltration weapons. They use this iron sight, if I remember well.

Re: DesiredFOV makes Weapon disappear.

Posted: Sun Apr 24, 2016 10:52 pm
by UTX
I will, thanks for the tip.

Re: DesiredFOV makes Weapon disappear.

Posted: Sun Apr 24, 2016 11:32 pm
by Carbon
Well, that's not an FOV thing, it's the game. This ain't Call of Unreal Warfare. ;)

Re: DesiredFOV makes Weapon disappear.

Posted: Mon Apr 25, 2016 6:06 am
by sektor2111
Of course it's FOV. Actually I'm allow FOV changes in my testing servers as long as I want to "zoom" with ANY weapon - read well WEAPON not only TournamentWeapon. And player have feature available while User.Ini it's properly configured:

Code: Select all

...
Aliases[25]=(Command="SetDesiredFov 10",Alias=Zoom)
Aliases[26]=(Command="SetDesiredFov 90",Alias=UnZoom)
...
MouseWheelDown=Zoom
MouseWheelUp=UnZoom
SetDesiredFov is pretty self explanatory, huh ?
Yes, whatever WeaponViewOffset is changed with FOV, I don't see what is wrong - is LOGIC. Even if you look far with a real Sniper-Rifle you cannot see weapon when you do seeking for enemy at long Ranges through lens.

Re: DesiredFOV makes Weapon disappear.

Posted: Mon Apr 25, 2016 1:33 pm
by Chamberly
Tbh it doesn't seem like it's FOV making your weapon disappear, because all I think of your weapon settings is set to hidden. I've used that alias before and my weapon didn't disappear.

Unless you're talking about something else... carry on.

Re: DesiredFOV makes Weapon disappear.

Posted: Mon Apr 25, 2016 3:48 pm
by sektor2111
For the clarification from first post - ZOOMING = FOV CHANGES. When you are changing FOV with a Normal Weapon it will be visible until a point and then you won't see it. Let's except seeking. Else you can check what I was posting and go figure when a normal weapon get vanished and which is FOV value. Then see Sniper code in cause. See Rifle.uc

Code: Select all

state AltFiring
{

function Timer()
{
	if (Pawn(Owner).bAltFire == 0)
	{
		if (PlayerPawn(Owner) != None)
			PlayerPawn(Owner).StopZoom();
		SetTimer(0.0,False);
		GoToState('Idle');
	}
}

Begin:
	if ( Owner.IsA('PlayerPawn') )
	{
		PlayerPawn(Owner).ToggleZoom();
		SetTimer(0.075,True);
	}
	else
	{
		Pawn(Owner).bFire = 1;
		Pawn(Owner).bAltFire = 0;
		Global.Fire(0);
	}
}
Said PlayerOwner is zooming. All right and what is that ?

Code: Select all

function ToggleZoom()
{
	if ( DefaultFOV != DesiredFOV )
		EndZoom();
	else
		StartZoom();
}
...
function StartZoom()
{
	ZoomLevel = 0.0;
	bZooming = true;
}
...
function EndZoom()
{
	bZooming = false;
	DesiredFOV = DefaultFOV;
}

event UpdateEyeHeight(float DeltaTime)
{
...
	if ( bZooming )
	{	
		ZoomLevel += DeltaTime * 1.0;
		if (ZoomLevel > 0.9)
			ZoomLevel = 0.9;
		DesiredFOV = FClamp(90.0 - (ZoomLevel * 88.0), 1, 170);
	} 
:ironic: Yes, I was wrong we don't have any relation between zooming and FOV... are just directly dependent + after some FOV angle any weapon is not more visible until you add some special tweak.
Cough, now I understand how are understanding others the reality from Unreal... :lol2:
Edit: PlayerViewOffset=(X=5.000000,Y=-1.600000,Z=-1.700000) SniperRifle - code is too simple and doesn't have any "HIDE" section.
Usually normal weaponry doesn't have too much PlayerViewMesh when zooming, perhaps those messed ones at Mesh or modified on purpose (one way is firing Off-Line and a sort of crap while ON-LINE and "features" - no Names because of RULE No.1 - even if they deserve to bite some mud).
You will want to compute a new PlayerViewOffset if weapon is zooming and put back default when is out of zooming + careful at weapon changes during this time... :mrgreen:

Re: DesiredFOV makes Weapon disappear.

Posted: Mon Apr 25, 2016 9:33 pm
by Carbon
sektor2111 wrote:Of course it's FOV.
sektor2111 wrote:I was wrong we don't have any relation between zooming and FOV
:satan: :wink:

My point was that when zooming, the perspective changes to the 'scoped' viewpoint. Sure, the FOV changes, but not in and of itself, unlike Unreal where zooming just brings a section of the scene towards you which would be more of an 'FOV'-thing.

Re: DesiredFOV makes Weapon disappear.

Posted: Mon Apr 25, 2016 9:57 pm
by sektor2111
It's always a FOV game (try to figure ironic "smilie"). Because you don't have to be Evil let coder to understand what is there and the rest make them happy with a LIE. They trust everything as long as in their laziness won't check classes. So:
1. Zooming is FOV ? YES for coders dealing with such stuff. ALL the time stuff is forced ignoring server directives because this is how works default Sniper. If server is configured "relaxed" any weapon can do ZOOM. It's a FOV change.

2. Zooming is FOV ? NO... um, because... whatever things creating a false satisfaction about knowledge (which doesn't exist) just some lulu.
3.Read again Title and first Post :wink: It's self explanatory enough.

Nearby subject:
When I was rewriting some weaponry for MH2 (or such) one of things passing through my sight was Rifle replacement aka OLRifle. Well... I could figure bugs, solution for mesh wrapping and... how to make a null Owner to play a sound :mrgreen: .
Of course by blabbering with weapons I could see how to load A.I. with 20 weapons without to mess "RateSelf" errors, making A.I. to use stuff correctly if weapon is coded well. Aside, I have modified Bot because it was addicted to a class called "SniperRifle" and this sort of stupid restriction did not fascinated me. I have changed rule with "Weapon != None && Weapon.bInstantHit" (also at some Monstruosity) actually Lords of Coding from Epic forgot their own bool variable helpers and explanations about these sniper related hints.

Re: DesiredFOV makes Weapon disappear.

Posted: Mon Apr 25, 2016 10:11 pm
by papercoffee
sektor2111 wrote: 2. Zooming is FOV ? NO... um, because... whatever things creating a false satisfaction about knowledge (which doesn't exist) just some lulu.
Ok? You've lost me there... I love to read your stuff, because even so I'm not a coder I learn something new.
But this sentence makes no sense for me. :noidea

Re: DesiredFOV makes Weapon disappear.

Posted: Mon Apr 25, 2016 10:17 pm
by sektor2111
Carbon selected some quote and a second one (special) so I was owing explanations for both sides.

Re: DesiredFOV makes Weapon disappear.

Posted: Fri Apr 29, 2016 6:04 am
by sektor2111
A bump here
Let's take a look at another similar problem with "Mesh-View"
Some people went busy for doing/using tools for creating a sort of brush replacement with mesh types. USELESS, time wasting, just another LULU.
Let see, we have a sort of Statue, Mesh not Brush. If you are coming very close and center of Mesh is out of your FOV suddenly will get vanished from your visual field - cute huh ? If that FOV makes center of mesh to no longer be "on screen" say bye to mesh view. If you can hold mesh with center on-screen you might get something different, I'm not waste time with other checks.

Re: DesiredFOV makes Weapon disappear.

Posted: Fri Apr 29, 2016 4:05 pm
by Barbie
sektor2111 wrote:center of Mesh is out of your FOV suddenly will get vanished from your visual field
Thanks for this hint. Just yesterday I was wondering about this effect in the Map MH-IceSkaarjPrologue that uses the (big) Mesh Upak.SpaceShip where players can (more or less) walk on. (See video)

Is it possible to convert a Mesh into a Brush?
<EDIT>
Added video link
</EDIT>

Re: DesiredFOV makes Weapon disappear.

Posted: Fri Apr 29, 2016 6:25 pm
by sektor2111
I cannot answer because I did not check these, I prefer "normal" way.

Re: DesiredFOV makes Weapon disappear.

Posted: Fri Apr 29, 2016 7:22 pm
by Wormbo
The relevant code is in Engine.Weapon.RenderOverlays(), where it checks whether the player's current FOV matches their desired FOV. If not (i.e. "zooming", the weapon simply won't draw itself.

You will have to replace (i.e. override without calling Super) the RenderOverlays() function in your weapon to include all its standard functionality, except the part where it skips drawing itself when zooming to a FOV level other than the configured default.