This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes


I've created face detection app in python that looks at webcam input and can tell where the face is located (bounding box). I want to somehow pass those coordinates to my Godot game to adjust a camera position and create something like a VR-effect on a flat display.

Is there some way to inform Godot about those coordinates other than making it via networking protocols like a Python-Godot multiplayer or REST API? Some shared memory or other way existing in Godot to communicate with other software?

in Engine by (207 points)

2 Answers

+3 votes
Best answer

godot has no integrated function to open a pipe to another process. Currently OS.execute() can be used to start a process and wait for the return on stdin or start a process non-blocking but does not return the output.

You can use the network protocol, this isnt too uncommen. Using the internal loopback address should prevent the packets to go through the whole network stack. Therefor this should be quite fast and lag free.

And there is allways the possibility to write a GDNative script but this requires advanced skills in c or c++ and compiling.

by (4,088 points)
selected by

Done it by writing Flask API in python and using normal HTTPRequest node in Godot to spam the API with requests every frame. It works:

nice work!!!

+1 vote

The other poster provided a fairly comprehensive answer. I will add some direct links to help other people that find this question via a search for 'REST API'.

OS function calls:

HTTP calls:

Not strictly related to your question, but something that is fairly common: you can combine these to open a link in a web browser.
OS.ShellOpen(""); (C#)
OS.shell_open("") (GDScript)

by (868 points)

REST APIs are generally unsuited to real-time applications due to HTTP protocol's overhead. Direct TCP communication can be much faster.

Direct TCP communication can be much faster.

Any ideas how to implement it? Where to look or what part of the manual? My knowledge of networks and multiplayer is zero. I would also like to connect godot with another app in c ++.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.