|
|
Line 1: |
Line 1: |
- | This is the workbench for Code documentation right now. All the things i'm documenting on the fly will start here and then be sorted into their individual pages. Such as [[Custom Input Controls]].
| + | If zou're looking for the old CodeCentral, that page has moved to [[UT2k4_CodeCentral]]. |
- | | + | |
- | <h2>[[Custom Input Controls |Custom Input Device integration]]</h2>
| + | |
- | Moviesandbox gives you the possibility to integrate your own input devices and characters by using the udp protocol to communicate between your input device and MSB.
| + | |
- | Once you transformed your Device data to UDP, you can send your data to port ''UDP 31840''+ channel. I'll explain below.
| + | |
- | | + | |
- | <h3>Setting up the structure within Moviesandbox</h3>
| + | |
- | In order to create your own custom interface to control your actors - as the GATech people did for example - you should take a look at the ''MSBCode.MSBPawnInputControl.uc'' file.<br>
| + | |
- | | + | |
- | Create your own custom Pawn by subclassing MSBObjects.MSBPawn and create your own MSBPawnInputControl by subclassing MSBPawnInputControl. Ideally you'll have your own package for both your new classes.
| + | |
- | Feel free to add functionality to your Pawn, like linking to your special skeleton.<br>
| + | |
- | | + | |
- | The Pawn automatically generates a PawnInputControl. All you need to do is to specify which class to use when generating the PawnInputControl. This is done in the Button that will create your pawn.<br>
| + | |
- | | + | |
- | Go ahead and sublass ''MSBMenuButtons.MSBCreatePawn'' and add the following piece of code to your new class:<br>
| + | |
- | | + | |
- | function LeftBtnFinished(Canvas C)
| + | |
- | {
| + | |
- | local Pawn P;
| + | |
- |
| + | |
- | P=Pawn(SpawnActor);
| + | |
- | MSBPawn(P).MSBPawnInputControl=Spawn(class'myPawnInputControl',P,,P.Location);
| + | |
- | super.LeftBtnFinished(C);
| + | |
- | }
| + | |
- | <br>
| + | |
- | whereas myInputControl stands for your InputControl class.
| + | |
- | | + | |
- | We're almost through! Now all you need to do is to make your Button appear within Moviesandbox. In order to do this, open the ''MSBButtonConfig.ini'' in your System folder.
| + | |
- | Find the [MSBCode.MSBMenuButtonStatic] part and add a reference to your button to the end of the list, like this:
| + | |
- | | + | |
- | .
| + | |
- | .
| + | |
- | .
| + | |
- | ButtonList=MSBMenuButtons.MSBCreateMyPawn
| + | |
- | | + | |
- | There you go! You're now all set up to program your own Input directives.
| + | |
- | | + | |
- | <h3>How to implement your own functionality</h3>
| + | |
- | The MSBPlayerInputControl has its own UDP socket, set to a port that can be defined within the Moviesandbox environment. After placing your character (using the button we created before), right click on it and set the UDP channel. This will set the UDP socket of this character's PAwnInputControl to port 31840+channel.
| + | |
- | | + | |
- | The PawnInputControl.Tick(float DeltaTime) function has access to the byte array that is being transferred each frame through udpLink.byteData[]. It also has access to a string conversion of said byte array through udplink.Data.
| + | |
- | An example on how you can use your input data can be found within the original MSBPawnInputControl, where the pressing of a gamepadbutton is transformed to a pose and moving the sticks is transformed to head or eye movement, following the data structure:
| + | |
- | | + | |
- | Byte0 -> xAxis
| + | |
- | Byte1 -> yAxis
| + | |
- | Byte2 -> uAxis
| + | |
- | Byte3 -> vAxis
| + | |
- | Byte4 -> ButtonNumber
| + | |
- | | + | |
- | <h2>General UDP Port Usage</h2>
| + | |
- | These ports are being used by Moviesandbox to communicate with tools or devices:
| + | |
- | | + | |
- | UDP 21840 -> speech with channel IN (from vvvv)
| + | |
- | UDP 31840 -> Device with channel IN (from Multi HID Input)
| + | |
- | UDP 41840 -> blocks IN (from Tracer)
| + | |
- | UDP 61840 -> Bone Rotations IN (from MoCap Tool)
| + | |
- | | + | |
- | <h2>General Lipsync Setup</h2>
| + | |
- | <h3>Voxel Lipsyncing</h3>
| + | |
- | MSBSimpleBlock has an implementation for Mimic() and Talk().<br>
| + | |
- | MSBMouthBlock uses the Talk() function to either switch a texture on the block OR move the block down and up.<br>
| + | |
- | In short:
| + | |
- | # You paint your voxel character.
| + | |
- | # You paint one or more MouthBlocks.
| + | |
- | # When saving/loading, you save the class of each block and the MSBVoxelpawn finds MSBMouthBlocks and references them in a "FaceBlocks" array.
| + | |
- | # In MSBPawn, when the LipSyncUDP (gets set up when changing the Channel) object triggers the pawn, it calls Talk();
| + | |
- | # In the MSBVoxelPawn class (child of MSBPawn), in the Talk() function, all FaceBlocks (parent class of mouth and eye block) get their talk() function called.
| + | |
- | | + | |
- | [[Category:Tutorials]] | + | |
- | [[Category:Coding]]
| + | |