Page 1 of 2

python to control player rotation?

Posted: Tue Feb 07, 2017 12:51 am
by museeeii
Is it possible to use python to send data to change in-game player orientation (pitch, yaw and roll)? If so, is there an example of such thing?

Re: python to control player rotation?

Posted: Tue Feb 07, 2017 4:24 am
by Barbie
Python is just another scripting language; if such would work with Python, it would also work with Perl, VBS or any other scripting language - Python has no special relationship to Unreal.

And manipulating Unreal's objects while it is running is possible by hooking system calls for example, but you need access to the computer where Unreal is running. But better ask a hacker for this. ^^

Re: python to control player rotation?

Posted: Tue Feb 07, 2017 5:14 am
by schwap
It is possible to do this if you spawn a UDP / TCP receiver class to interpret the rotation calls.

Re: python to control player rotation?

Posted: Tue Feb 07, 2017 7:40 am
by SilverSound
Why would you need such a thing in the first place? I'm just curious.

Re: python to control player rotation?

Posted: Tue Feb 07, 2017 2:40 pm
by papercoffee
SilverSound wrote:Why would you need such a thing in the first place? I'm just curious.
This

It sounds highly suspicious.

Re: python to control player rotation?

Posted: Tue Feb 07, 2017 2:44 pm
by JackGriffin
I wouldn't jump too hard on OP for asking. There's a ton of things to be done with UEngine and a virtual reality headset (for example). UT's simplicity would allow a pretty easy connection to a VR rig.

I'm curious too Silver but probably for different reasons.

Re: python to control player rotation?

Posted: Tue Feb 07, 2017 6:27 pm
by museeeii
I am just trying to send rotation data from my android to control player orientation.

@schwap do you know where do I found more info about UDP / TCP integration?
@Barbie I thought in making python save a file containing the info I need in game, then, in game, I read the file contents every tick. But problems may occur when concurrent operations of write/read take place. Yes, I have control over client machine =D

Re: python to control player rotation?

Posted: Tue Feb 07, 2017 6:33 pm
by museeeii
BTW, I am already passing data through web sockets over local address: 192.168.1.14:8000
Is there a way to Unreal capture the data direct from that address?

Re: python to control player rotation?

Posted: Tue Feb 07, 2017 6:37 pm
by sektor2111
You can stop multiple posting withing 24 hours and do use EDIT button instead.

Re: python to control player rotation?

Posted: Tue Feb 07, 2017 9:31 pm
by schwap
museeeii wrote: @schwap do you know where do I found more info about UDP / TCP integration?



The thing you're trying to do has been done already
(external program to modify rotation) - and theres a neat example on BeyondUnreal by Matthieu29.
It is actually made for UT2003.. but I guess it'll work on UT99 just fine. (might need a few changes, didn't check)

-> https://wiki.beyondunreal.com/Legacy:UDP_Server_Sample <-

For more informations have a look at these classes:


If you get it done, a video where you control the pawns rotation with your smartphone would be neat. :agree1:

Re: python to control player rotation?

Posted: Tue Feb 07, 2017 9:53 pm
by Barbie
If the intention is using another device than keyboard and mouse for player control: why not using the existing interface? The VR controller could simply simulate mouse and keyboard events...
museeeii wrote:I thought in making python save a file containing the info I need in game, then, in game, I read the file contents every tick.
Transferring data though a file as interface is limited by mass storage speed and UScript's inability reading data from a file (except a corresponding INI file).

Re: python to control player rotation?

Posted: Tue Feb 07, 2017 10:17 pm
by museeeii
Thank you very much for your reply guys!
I am very excited because I just have done the script that rotates the player to a specified orientation, and its working! uhuu
If you get it done, a video where you control the pawns rotation with your smartphone would be neat.
Sure I will post a video here to share with you guys. And the source code will be in my GitHub as well the Mutator for download.

@schwap thanks for the links. I will start read it after now. I will try to understand those uc files and try to implement it
If the intention is using another device than keyboard and mouse for player control: why not using the existing interface? The VR controller could simply simulate mouse and keyboard events...
My real intention is to make a VR Cyberith treadmill-like platform for UT99, one you can walk, run, jump, turn, shot and so on.

Re: python to control player rotation?

Posted: Tue Feb 07, 2017 11:07 pm
by JackGriffin
And now I'm REALLY interested....

Re: python to control player rotation?

Posted: Wed Feb 08, 2017 2:34 am
by SilverSound
JackGriffin wrote:And now I'm REALLY interested....
That's amazing to think about isn't it? Just think about what it would look like to do BT with that sort of set up.

Re: python to control player rotation?

Posted: Wed Feb 08, 2017 4:37 am
by museeeii
I finally did it folks!
Much thanks for @schwap to point me to a great UDP resource

Yes, the player is now controlled by my Android phone (only orientation so far) and the result was a great ... CRAP...
oh man, it is so frustrating :cry:

Just to get you know, I got two problems now:
The player rotation gets really laggy since the data is transfered through UDP socket. But I dont really know if it's because UDP. But the result of rotation in game happens only after a second or two;

The second problem is the camera being shaking, even if the phone is completely in rest over the table. Looks like the player got Parkinson's :loool:
I am using the magnetometer (Compass) to capture Android orientation and it is always oscilating from a range up to 10 degrees. I know I can try to smooth these oscilations but...