Howto add scope functionality in a gun?

hi. i made a gun and i need help to add the scope functionality (iron sights or scope ).

P.S i am not using a flyCam

hmm ok… this reads like this :

"Hello, I made a pie and i need help to add the “can fly” functionality.

P.S. I don’t wear red trousers."

Read this and start over : mikeash.com: Getting Answers

2 Likes

What I would do is mess with the cam frustum (far I believe), and that will change the scope of how it looks to you.

I would find a nice amount, and apply it to your scope command, which would bring up the scope, and then be zoomed in enough to show the affect. Zoom might also work, instead of messing with the Frustum, but it’s really a matter of finding “the sweet spot” that you want.

I have added some code to my own project in order to change the view modes, but it’s really just an increase/decrease in the settings.

As for “not using a flycam”; you should probably explain what you’re doing, you’re super vague, and it’s the reason why a lot of people probably wont answer.

i understand and sorry i am using the flyCam
i had written it by mistake

Quick and dirty would be, when using zoom, to:

  • add a plane in front (GUI?) (transparent where you want to be able to see)
  • change camera spectrum

And reset when you get out of it.

Mind you, stuff far away could be either culled by the engine or simply not attached if you attach/detach depending on location of player.