Rearview Mirror

This seems like a feature a lot of driving games would want. Sorry if I missed the answer.

I know you can use video-textures to make mirrors, but for my game the mirror doesn’t need to move in relation to the screen, and it’s fine if it’s rectangular. So I thought just using a viewport with a rear-facing camera would work. The problem with this is that the image in the mirror is not mirrored!

So all I need to do is flip the viewport L-R and I’ll be in business. Does anyone know how to do that? Or, is there a better (performance-wise) way to have a rear-view mirror?

Thanks.

I’m not sure how to flip the viewport - maybe you could flip the camera? I’ve never tried multiple viewports. The VideoTexture / bge.texture method is probably the best, as it’s fairly easy to deal with.

Yeah, flipping the camera would work, but I don’t know how to do that. Scaling it seems to have no effect.

If someone has some ideas about where to start trying to implement a feature like this in the source, I might try and add it.

I would actually recommend using videotexture (probably not the mirror function, just render to texture from another camera would do fine), for a few reasons-
-you can use odd shapes- mirrors generally aren’t perfectly rectangular, and generally at a slight angle to the driver- you can’t do either of those things with viewports, but you can with render to texture.
-you can use camera movement more easily- if you want to make the player feel like they’re in a car, you really need to have at least slight movements of the camera, like when the car takes a turn or hits a bump.
-mirroring the view is as easy as scaling the UV coordinates horizontally.

thank you for your suggestion it seems to be work.