I was using the tutorial project by @yaustar called “Gun clip on top” and it doesn’t seem to work. Please help me.
My Project Link: https://playcanvas.com/project/1275754/overview/fps-game
@yaustar 's Tutorial Project Link: https://playcanvas.com/project/820368/overview/gun-clip-on-top
1 Like
It will be fixed if you fix the following:
Set the priority of your shotgun camera to 1
Remove the “Clear Color Buffer” check from Shotgun camera
Set layers properly in Settings → Layers → Render Order
You can check it is working in this project: PlayCanvas 3D HTML5 Game Engine
1 Like
yaustar
November 16, 2024, 12:57pm
3
I’ve got another project that uses a single camera to do this using layers and clearing the depth buffer before I render the gun layer.
https://playcanvas.com/project/1067030/overview/fps-pit-fork
See layer order:
And code that adds the clear depth buffer flag on the Clear Depth layer https://playcanvas.com/editor/code/1067030?tabs=131104600&focused=131104600
(function() {
const app = pc.Application.getApplication();
app.on('start', () => {
// We have special layer that we want to set so that it clears the depth buffer
// This helps us render the weapon on top of the world
const clearDepthLayer = app.scene.layers.getLayerByName('Clear Depth');
clearDepthLayer.clearDepthBuffer = true;
});
})();
2 Likes
ALUCARD
November 16, 2024, 2:35pm
4
That project fails to load for me
1 Like
Fork the project and go into its settings. Click on Physics and import the ammo.js .
For more information, see this page: Updating ammo.js | PlayCanvas Docs
1 Like
ALUCARD
November 16, 2024, 7:04pm
6
im sayin he should update the ammo in his project so people can see it in action
1 Like