On right click change fov

Hey!

For my game, (I’m now calling it a “game” and no longer a project) I need to have an “aim.” for this, i’m changing the camera’s fov and moving the gun. I’ve gotten the camera’s fov to change on keypress, but how do I do it with a right click. Like this: On right click down, zoom in. On right click up, zoom out. Here is a playground of what i’ve tried, but it doesn’t work.

Any help is greatly appreciated!
Givo

PS: Can there be an animation that goes along with it too? @Wingnut like your last solution but the rifle is in the middle of the screen like using the iron sights.

Thanks!

here we are:
https://www.babylonjs-playground.com/index.html#TAZ2CB#20

(including animation because I’m a kind guy)

2 Likes

I can confirm that, wholeheartedly. :slight_smile:

A guy could use scene.actionManager with a held-right-button trigger… if we have such. If not, ActionManager onRightButtonDown can be sort of looped… to create a held-right-button trigger/action, I think.

Deltakosh once built one for me… but I lost it. :slight_smile: But actionManagers are the coolest thing ever… yet still not as “tight” as Delta’s scene.onPointerDown DOM-ish method. That’s seriously tight/little! I made an ease-in version… a bit slower.

Interesting topic. We just KNOW that Givo is thinking about a Gun-at-the-hip view (like now)… AND a look-thru-the-scope view. In scope-view… Givo will go full-screen and put a high-tech crosshairs in the center… maybe with an encircle ring (GUI)… and have FOV numbers rolling-along on the sides of the crosshairs… range… bullet drop projection numbers, cross-wind prediction numbers, etc.

Sniperville 1.0 - De-Frogging the Farm Pond. heh.

Thanks for the replies! I’ll just modify them a little! Thank you guys!

1 Like

I just realized I said a form of “thanks” twice.:grin:

2 Likes