TUTORIAL: Making Binoculars

Hello everyone… instead of studying for Art History I decided to make you a little tutorial and demo file about how to make working binoculars for your game! :eyebrowlift: My loss is your gain here…don’t miss out! Get your Binoculars going now! Happy Blending! :smiley:

Thank you for this :slight_smile:

Nice Tut!
Very Useful.
I made a slight addition that lets you zoom in / zoom out:
You might find that useful :smiley:

Nice work! I never realized that there was a Lens IPO available… I should add that to an extended version of the tut (with all due credit of course) :wink:

no prob - Thx for making a simple good tutorial. i could really use it

…u help me , i help u…:wink:

alternatively, you can use the lens IPO to zoom the main camera in- but I see you didn’t know about that. Nice tut, clearly explained and useful. We could really do with more tutorials for the GE, thanks for contributing! (I’d write some, if I didn’t learn everything I know from tuts- maybe once I actually manage to finish a game…)

ooh, you could also use an alpha IPO to fade the binoculars plane into view, all professional-like, and put a zoom amount meter in, and… oh, wait, I’m overdoing it…

Very nice. I would use a lens ipo for sure though; then you wouldn’t need to have two cameras. I didn’t think about toggling a boolean with “!value”, thank you very much!


Nice tut PlantPerson. Thanks
Sorry for your History Art…
Another tip : In adding the overlay scene you can use some Plane with ADD effect to give color effect to make night vision - you know green color overlay, cool blue overlay or even a red alert overlay

thanks for the cool tut~

yeah thanks plant … REALLY !

alternatively you can use python to change the lens value for the camera. the code would be something like this:

import GameLogic as G
cont = G.getCurrentControler()
own = cont.getOwner()
own.lens = somevalue

the camera has the python controller and you can use any sensor to get a value for lens. like maybe a mouse scroll sensor to zoom in and out with the mouse wheel. In a tank game i made i had a fixed camera that tracked to the tank and the lens varied in proportion to the distance from the camera to the tank so it zoomed in as the tank got farther away.

it was like this:

import GameLogic as G
import math
cont = G.getCurrentController()
own = cont.getOwner()
distpoint = cont.getActuator("distpoint").getOwner()
tankpos = distpoint.getPosition()
campos = own.getPosition()
dx = float(tankpos[0]) - float(campos[0])
dy = float(tankpos[1]) - float(campos[1])
dz = float(tankpos[2]) - float(campos[2])
distance = math.sqrt(dx*dx + dy*dy + dz*dz)
#print distance
own.lens = distance * 2

and the tut is very nice, thanks :slight_smile:


Beautiful tutorial. Very nicely done. I didn’t know about the lens IPO either, but I’m glad to have learned about it, because I can now eliminate three objects, two parenting relationships and a TrackTo actuator from my Sokoban setup.

An excellent thread. Let the learning continue.


Thanks for the cool tuts.

Thanks marvo, but I made a point not to include python in the tutorial. It’s aimed at the beginner, so I wanted to make sure it was as simple as possible.

Blendenzo: yay! I’m approved!

Well done PlantPerson! This is a great resource for those who are into FPS games. I’ll be needing this in the future = )

There is no python in the tutorial, but there is python in the thread. I thought maybe a more advanced user might be able to have a little more freedom using that method, so i posted it.:yes: a thread like this attracts everybody.

Thanks alot, PlantPerson! Amazing tutorial! You made it possible for me having a sniper sight in my duck hunt game!
Edit: Sorry, I thought it was 08, not 07.

That was quite a bump :wink:

Gotta check that whole date, dude. Not just the month!
Anyway, I’ll update the link and move this fella to the Resources forum.

Heh, well, I ultimately got an A anyway, so I guess I didn’t play hooky from my studies for too long.