I’m trying to make a minimap for a car game im developing with Rainbow Brit.
What I want to achieve is to hang a camera above the scene and use the camera output as a texture on a minimap model in aspect2d. I’ve been looking at the manual (GraphicsBuffer, texturebuffers etc) and the forums for a clue as to how to achieve this, but I can’t figure out to do it.
Could someone with a clear understanding of how to do this point me in the right direction please?
I read that it should also be possible to make a texture card from a texturebuffer, which would be nice since then I would not need to worry about making a model to hang the texture on. Some directions here would be appreciated, too.
The BVW resource page has a link to a minimap example which might help. They use a camera, I believe:
etc.cmu.edu/bvw/scripting/mo … inimap.zip
I wanted to use little icons on my minimap (which happens to be a fishfinder) so I used texture cards instead of a camera. I took my PNG images and compiled them into one egg file like this:
egg-texture-cards -p 256,256 -o fishfinder.egg fishfinder.png fishfinder_trout.png
Here is the class I use for updating it. This is just a prototype so it only shows one fish, but it should demonstrate the technique I’m using:
fishfinder_model = loader.loadModel("fishfinder")
self.screen = fishfinder_model.find("**/fishfinder")
self.fish = fishfinder_model.find("**/fishfinder_trout")
self.world = aspect2d.attachNewNode("fishfinder")
self.world.setPos(1, 0, .7)
def update(self, task):
pos = trout.getPos() - player.world.getPos()
pos = Point2(pos.getX(), pos.getY())
pos /= 50
if Vec2(pos).length() > 1:
self.fish.setPos(pos.getX(), 0, pos.getY())
Thanks for answering, and for the useful link!
We ended up using makeCamera:
mmCam = base.makeCamera(base.win, sort = 10, displayRegion = (0.5, 1, 0.5, 1))
It looks really cool!
You should all try it