Closed Nesh108 closed 7 years ago
Yes - anything that's stored in an entity component can be accessed by doing something along these lines:
var fadeState = noa.ents.getState( noa.playerEntity, noa.ents.names.fadeOnZoom )
fadeState.cutoff = 0.1
If you have not seen Entity Component Systems, you might want to read up on them a bit (e.g. at wikipedia), or it may not make any sense :grin:
With that said however, I have not done anything with having a hand stay visible, so you might need to do some tweaking to this. E.g. when the camera is in the zoomed out state, show a full mesh, and when it zooms in beyond some point show a different mesh that's just a hand, or similar?
But suffice to say, if you want to get rid of the built-in component function, the right way to do it is to remove the fadeOnZoom component (noa.ents.removeComponent(...)
) from the player entity, add a component of your own, and so forth.
Sweet!
Btw, I have used them quite a bit in Unity, so it's not too much of a problem to adapt :)
With my modification, here is how it looks like this now (with a lame-ass mesh as weapon :P):
Is there a way to set the value of
state.cutoff
in fadeOnZoom.js?At the moment I changed that value directly on the code but I would like to have more control over it. In many cases, having a very low cutoff (I set it to 0, with minimum zoom being 0.1) is needed in order to be able to see the player's hands while being in first person.