Skip to content

Instantly share code, notes, and snippets.

@darkwave
Created April 12, 2017 10:24
Show Gist options
  • Save darkwave/d6e9c72a66e728b7ee8fb59555119640 to your computer and use it in GitHub Desktop.
Save darkwave/d6e9c72a66e728b7ee8fb59555119640 to your computer and use it in GitHub Desktop.
How to acquire webcam as a texture in Blender Game Engine
#WebCamAsTexture.blend is copyright sean bradley 2014
import bge
cont = bge.logic.getCurrentController()
obj = cont.owner
if not hasattr(bge.logic, 'video'):
matID = bge.texture.materialID(obj, 'IMvideolayer.png')
bge.logic.video = bge.texture.Texture(obj, matID)
bge.logic.video.source = bge.texture.VideoFFmpeg("0", 1)
bge.logic.video.source.play()
bge.logic.video.refresh(True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment