About Store Forum Documentation Contact



Post Reply 
How to render an object on top of others
Author Message
tipforeveryone Offline
Bronze Supporter

Post: #1
How to render an object on top of others
In some FPS game, hand and gun model are rendered and placed on top of render stack, to avoid gun clipping into wall and obstacles. How can I do the same in Titan Engine ?
06-20-2022 05:13 PM
Find all posts by this user Quote this message in a reply
RedcrowProd Offline
Member

Post: #2
RE: How to render an object on top of others
you can try using this :
RM_BEHIND , // here you can optionally draw meshes which are behind the visible meshes using 'Mesh.drawBehind'

and just have your gun model call mesh.drawbehind.
i never used this, it might have a different shader applied to it, but worth a try.

else you would have to mess with the Z depth effect i believe so the mesh is always considered closer than anything else
06-20-2022 05:30 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #3
RE: How to render an object on top of others
I recommend doing collision detection, and when gun intersects with a wall, just move it back.
I do the same in my Into The Dark dungeon game.
06-20-2022 05:45 PM
Find all posts by this user Quote this message in a reply
tipforeveryone Offline
Bronze Supporter

Post: #4
RE: How to render an object on top of others
(06-20-2022 05:45 PM)Esenthel Wrote:  I recommend doing collision detection, and when gun intersects with a wall, just move it back.
I do the same in my Into The Dark dungeon game.

This is how my gun setup currently too grin but sometime I really need it to be brought to front.

(06-20-2022 05:30 PM)RedcrowProd Wrote:  you can try using this :
RM_BEHIND , // here you can optionally draw meshes which are behind the visible meshes using 'Mesh.drawBehind'

and just have your gun model call mesh.drawbehind.
i never used this, it might have a different shader applied to it, but worth a try.

else you would have to mess with the Z depth effect i believe so the mesh is always considered closer than anything else

Thanks, Im gonna try it
(This post was last modified: 06-21-2022 03:15 AM by tipforeveryone.)
06-21-2022 03:13 AM
Find all posts by this user Quote this message in a reply
Post Reply