Jump to content

Interactive Objects in Foreground World


TylerH
 Share

Recommended Posts

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

52t__nvidia.png nVidia 530M cpu.gif Intel Core i7 - 2.3Ghz 114229_30245_16_hardware_memory_ram_icon.png 8GB DDR3 RAM Windows7_Start.gif Windows 7 Ultimate (64x)

-----

IconVisualStudio16.png Visual Studio 2010 Ultimate google-Chrome.png Google Chrome PhotoshopLinkIndicator.png Creative Suite 5 icon28.gif FL Studio 10 MicrosoftOfficeLive.png Office 15

-----

csharp.png Expert cpp.png Professional lua_icon.png Expert BMX Programmer

-----

i-windows-live-messenger-2009.pngskype-icon16.pngaim_online.pnggmail.pngicon_48x48_prism-facebook.pngtunein-web.pngyahoo.giftwitter16.png

Link to comment
Share on other sites

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

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.

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

The additional world and cleared depth buffer ultimately worked. Thanks to both of you!

52t__nvidia.png nVidia 530M cpu.gif Intel Core i7 - 2.3Ghz 114229_30245_16_hardware_memory_ram_icon.png 8GB DDR3 RAM Windows7_Start.gif Windows 7 Ultimate (64x)

-----

IconVisualStudio16.png Visual Studio 2010 Ultimate google-Chrome.png Google Chrome PhotoshopLinkIndicator.png Creative Suite 5 icon28.gif FL Studio 10 MicrosoftOfficeLive.png Office 15

-----

csharp.png Expert cpp.png Professional lua_icon.png Expert BMX Programmer

-----

i-windows-live-messenger-2009.pngskype-icon16.pngaim_online.pnggmail.pngicon_48x48_prism-facebook.pngtunein-web.pngyahoo.giftwitter16.png

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...