DesiredFOV makes Weapon disappear.

Discussions about Coding and Scripting
UTX
Skilled
Posts: 214
Joined: Fri Aug 28, 2015 3:39 am

DesiredFOV makes Weapon disappear.

Post by UTX » Sun Apr 24, 2016 10:19 pm

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.

User avatar
papercoffee
Godlike
Posts: 9381
Joined: Wed Jul 15, 2009 11:36 am
Personal rank: coffee addicted !!!
Location: Cologne, the city with the big cathedral.
Contact:

Re: DesiredFOV makes Weapon disappear.

Post by papercoffee » Sun Apr 24, 2016 10:45 pm

Maybe you should look into the code of the Infiltration weapons. They use this iron sight, if I remember well.

UTX
Skilled
Posts: 214
Joined: Fri Aug 28, 2015 3:39 am

Re: DesiredFOV makes Weapon disappear.

Post by UTX » Sun Apr 24, 2016 10:52 pm

I will, thanks for the tip.

User avatar
Carbon
Inhuman
Posts: 841
Joined: Thu Jan 17, 2013 1:52 pm
Personal rank: Hoarder.

Re: DesiredFOV makes Weapon disappear.

Post by Carbon » Sun Apr 24, 2016 11:32 pm

Well, that's not an FOV thing, it's the game. This ain't Call of Unreal Warfare. ;)

User avatar
sektor2111
Godlike
Posts: 4138
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: DesiredFOV makes Weapon disappear.

Post by sektor2111 » Mon Apr 25, 2016 6:06 am

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.

User avatar
Chamberly
Godlike
Posts: 1755
Joined: Sat Sep 17, 2011 4:32 pm
Personal rank: Dame. Vandora
Location: TN, USA
Contact:

Re: DesiredFOV makes Weapon disappear.

Post by Chamberly » Mon Apr 25, 2016 1:33 pm

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.
Image
Image
Image

User avatar
sektor2111
Godlike
Posts: 4138
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: DesiredFOV makes Weapon disappear.

Post by sektor2111 » Mon Apr 25, 2016 3:48 pm

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:

User avatar
Carbon
Inhuman
Posts: 841
Joined: Thu Jan 17, 2013 1:52 pm
Personal rank: Hoarder.

Re: DesiredFOV makes Weapon disappear.

Post by Carbon » Mon Apr 25, 2016 9:33 pm

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.

User avatar
sektor2111
Godlike
Posts: 4138
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: DesiredFOV makes Weapon disappear.

Post by sektor2111 » Mon Apr 25, 2016 9:57 pm

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.
Last edited by sektor2111 on Mon Apr 25, 2016 10:14 pm, edited 1 time in total.

User avatar
papercoffee
Godlike
Posts: 9381
Joined: Wed Jul 15, 2009 11:36 am
Personal rank: coffee addicted !!!
Location: Cologne, the city with the big cathedral.
Contact:

Re: DesiredFOV makes Weapon disappear.

Post by papercoffee » Mon Apr 25, 2016 10:11 pm

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

User avatar
sektor2111
Godlike
Posts: 4138
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: DesiredFOV makes Weapon disappear.

Post by sektor2111 » Mon Apr 25, 2016 10:17 pm

Carbon selected some quote and a second one (special) so I was owing explanations for both sides.

User avatar
sektor2111
Godlike
Posts: 4138
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: DesiredFOV makes Weapon disappear.

Post by sektor2111 » Fri Apr 29, 2016 6:04 am

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.

User avatar
Barbie
Godlike
Posts: 1722
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: DesiredFOV makes Weapon disappear.

Post by Barbie » Fri Apr 29, 2016 4:05 pm

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>
Last edited by Barbie on Sat Apr 30, 2016 12:57 am, edited 1 time in total.
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett

User avatar
sektor2111
Godlike
Posts: 4138
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: DesiredFOV makes Weapon disappear.

Post by sektor2111 » Fri Apr 29, 2016 6:25 pm

I cannot answer because I did not check these, I prefer "normal" way.

User avatar
Wormbo
Adept
Posts: 258
Joined: Sat Aug 24, 2013 6:04 pm
Contact:

Re: DesiredFOV makes Weapon disappear.

Post by Wormbo » Fri Apr 29, 2016 7:22 pm

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.

Post Reply