VR Melee Example with Free Play


This example requires the Melee Module for Game Creator 1 from Catsoft Works to be installed and the Example Module must be enabled. This example has been configured with Basic IK but can easily be changed to use Final IK from RootMotion.  To demonstrate the VR functionality, we have used the Melee example that is supplied with the Melee Module, and added the VR Module components to it. We have also used the First Person Camera and Player model for this example, and made changes to the Player Sword to enable free play using a Box Collider to interact with the Enemy Character.


Note: To proceed with this example, you will need to expand the Unity Package file.


The Trigger On Start sets up the First Person Camera by calling that preconfigured Action. This Action inactivates the IK Solver, changes to the first person camera motor and player model, sets the player to move with the camera direction, includes a 0.5 second wait (could be reduced) to ensure the Character model is instantiated before the IK Solver is Reset.


First you must import the Melee Integration package from the VR Module/Melee folder. Then Melee example can work in either of two ways, or both together. The Melee module from Catsoft was designed to be played using the Keyboard or other fixed input, and with preconfigured animations for attack and defend. These can still be used by adding the Melee actions to the Hand Control Inputs in the same way you would add them to a keyboard Trigger. However, we also provide the ability to free play, by adding a box collider to the Player Sword and a collider script that triggers an Attack on the Enemy Character. A Box collider with this Hit Collider script can be adding to any weapon that the player uses.



To play canned animations that are included in the Melee Module, simply inactivate the IK Solver, call the Melee Input Action, wait until finished, and then reset the IK Solver. Add this set of Actions to any of the Input field on the Hand Control. The Block Action should be in two parts, inactivate IK and start block on press, and stop block and reset IK on release. Start and Stop Block Actions have been added to the Left Hand Controller Grip in the Example Scene. The Attack Action has been added to the Right Hand Controller Grip.



The example scene includes First and Third Person (Adventure) cameras. The A button on the Right Hand Controller toggles between these views. The Actions Inactivates the IK, changes the Player Model, Camera Motor, and Camera direction. Once this is done, we need to Draw the Melee weapon again, as it is a different Model.



The X button on the Left Hand Controller Calibrates the Player Height, but this depends on how you have set up you VR environment in the Headset. The Right Hand Trigger has the in-game screen capture, so you can record all your best melee moves.

Useful Links

Pivec Labs









Full list