I am adding iron sights aiming for my game’s first person view mode, for all guns.
I got the programming part done, it was very simple, I just modified the zooming function of UTWeapon class by calling the function PlayWeaponAnimation to play some custom animations, since I created new boolean variables to store the ironsights animations, in, out and fire. In simple terms, I used a custom animation to reposition and rotate the guns to simulate the ironsights aiming.
The problem is that I don’t understand why objects which are too close to the player’s view got a bug, like backface occluding or something like, the inner part of the gun appears, and it should not appear.
Here is how the gun should look (this is inside 3dsmax)
Thanks my friend, but the problem is that I am using a custom build of UDK Engine from May 2011, and in this build you can NOT change the nearclipplane in ini files. So I am kind of stuck
Also by reading on the old udk engine forums, I have seen that changing the near clip plane can cause all sorts of rendering problems, specially regarding the depth sense of far objects.
Without C++ access, the ini file is the only way to change the near clip plane. Can you change it in any other *Engine.ini files? For example, do you have that line in you MyGameEngine.ini file?
The reason for the clipping plane is the way the depth buffer works. Depth is calculated with more precision the closer the object is to the camera. Once the object is far away, the engine makes very rough estimates of depth. That often isn’t a problem with static meshes, but decals can get very messed up if the engine doesn’t get their depth right. Setting a near clipping plane moves the depth buffer out farther. Usually if it’s just a few Unreal Units, there’s no noticeable difference. But with my game, where the camera can be thousands of UUs away from the action, I need to control the near clipping plane.
If you’re certain you can’t change the near clipping plane in the ini files, then you’ll probably need a workaround. Maybe put the camera a little farther away and decrease the field of view a little more.
Hello my friend Nathaniel, thanks for trying to help me.
Unfortunately the ability to control the NearClipPlane through ini files was added on July 2011 Build, while my custom UDK is based on the May 2011 build. However, yes, I do have C++ access, because my custom build of UDK Engine, and I already found the file where is declared the NearClipPlane:
Development\Src\Core\Src\Core.cpp
FLOAT NEAR_CLIPPING_PLANE = 10.0f; /* Near clipping plane */
But the problem is that my PC is very old, it takes many hours the rebuild the entire UDKGame source code in Visual Studio. And also I use a lot of decals on my game’s maps, many particles also, so maybe changing the Near clipping plane for fixing my weapons can break other things.
Since I just wanted to change a bit the zoom aiming of my game, because many players complained of the zoom aiming of my game, just a non smooth transition from normal to zoomed mode, I decided to make something similar to iron sights of modern games.
And since this is just a cosmetic feature, I realized that it does not need to be exactly like those modern shooters, since I am looking for giving my game a retro vibe. So I simply changed the position of the gun on the iron sight animation, like this
This far cliping plane is very strange. Why I can not chose in setting change distance of this plane?
I found partialy fix vis broblem just scaling my person and scaling gravity force, speed movement, jump velosity (but only for not complex characters this work).
Wery anoing this cliping plane, that it is so far…
So I can not make first person game, because it culing hands of person…
And it culing ground and walls, so player can see what is under ground or wall… Then I scaling character 5-10 times, then this problem goes…
I found console comand r.SetNearClipPlane 1. Defaoult is r.SetNearClipPlane 10…