TylerH Posted May 27, 2011 Share Posted May 27, 2011 THe age old problem I have had with guns that magically clip into the world geometry (example the AK in the tunnels.sbx file included with the SDK) hasn't seemed to have been solved. My idea was simply: can we have these gun entities in a separate world that is rendered ontop of everything else? Then the guns would always be draw on top. For a first person perspective game this wouldn't be an issue at all as far as I can tell. Just looking to see if anyone has done this, has another way of preventing this, or would like to discourage or encourage me to try and post my results. Thanks, Tyler Quote nVidia 530M Intel Core i7 - 2.3Ghz 8GB DDR3 RAM Windows 7 Ultimate (64x)----- Visual Studio 2010 Ultimate Google Chrome Creative Suite 5 FL Studio 10 Office 15 ----- Expert Professional Expert BMX Programmer ----- Link to comment Share on other sites More sharing options...
Marleys Ghost Posted May 27, 2011 Share Posted May 27, 2011 http://www.leadwerks.com/werkspace/topic/2857-how-to-prevent-fps-weapon-from-going-into-obstacles/page__view__findpost__p__26615 Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
Flexman Posted May 27, 2011 Share Posted May 27, 2011 We use a separate 'cockpit' world to render personal inventory items (guns, map, compass) and helicopter / vehicle cockpits. It has over advantages too, it prevents intrusion of emitters, water and fog effects into these spaces. And you can keep the object co-ordinates of this space at the origin so there are no precision or zbuffer problems and camera ranges are pretty shallow too. The downside is you have to handle continuity of lights between worlds. I duplicate the directional light in such a world using something like this (edited for simplicity)... MyGame.CockpitWorldDLight.SetRotation(EntityRotation(MyGame.PlayerCcontroller, 1).Minus(MyGame.SunLightPivot.Rotation).Inverse()); This moves the cockpit world directional light around the vehicle in such a way it matches an objects rotation in the main 3D world (where the 'sun' is a directional like parented to pivot "SunLightPivot"). Duplicate ambient light where appropriate. Muzzle flashes are easily duplicated in both worlds if needed on a weapon. This might sound like total gobbledygook and overly complicated, often simple is best but this worked best for us due to world scaling/environment and precision issues. In a nutshell, after rendering the main 3D world, the depth buffer is cleared, cockpit world rendered then drawn over the top. Quote 6600 2.4G / GTX 460 280.26 / 4GB Windows 7 Author: GROME Terrain Modeling for Unity, UDK, Ogre3D from PackT Tricubic Studios Ltd. ~ Combat Helo Link to comment Share on other sites More sharing options...
TylerH Posted May 27, 2011 Author Share Posted May 27, 2011 The additional world and cleared depth buffer ultimately worked. Thanks to both of you! Quote nVidia 530M Intel Core i7 - 2.3Ghz 8GB DDR3 RAM Windows 7 Ultimate (64x)----- Visual Studio 2010 Ultimate Google Chrome Creative Suite 5 FL Studio 10 Office 15 ----- Expert Professional Expert BMX Programmer ----- Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.