Last Thursday the class was introduced to Ethan, a rigged humanoid model from Unity’s Standard Asset pack. The topic at hand was ragdolls and physics, and had been assigned to create a game involving Ethan or another model sourced elsewhere. We had creative control of the project as long as a ragdoll was involved.
I decided to make a simple golf level using a ragdoll as the ball, creatively named Ethan Golf. A game where you launch Ethan into the course and navigate him to the hole. This being my first venture into using character models I wouldn’t take completion of this task as seriously as the previous weeks and focus more on experimenting with certain systems within Unity, mainly Physics. I can never seem to create a controller using physics that works the way I intend. I also attempted using a couple of new programs this week to aid in the creation of this game.
For the sake of Education I had a go at making my own character for the game, I used makeHuman to generate a model and Blender to rig its skeleton. Make Human was a straightforward program to use, set up like many character creation systems in games. You can make changes to certain aspects of the preset characters allowing for total customisation, for my project I avoided these and chose a simple path by choosing a preset model and clothing it. Blender the second piece of software was much hard to use. Its mouse and keyboard layout where different to anything I had used before, and after 3 hours of tutorials I learnt how to rotate the object, delete an object and not much more. Itching to move on with the project and focus more on the scripting the decision was made to just use Ethan as the ragdoll model as he was ready to use.
Most of this project was completed at ease, though difficulty arose when creating the scripts that controlled the launching of Ethan. Several times throughout the project oddly high multipliers had to be used in the force calculations to get close to desired behaviour from the game. To launch Ethan, the minimum force multiplier was set to 1
50 and the maximum was 5 times that. I am almost certain though that these problems are cause by my lack of knowledge about physics and proper use of the Unity length, weight, and force units. Throughout the level there are randomly spawned effects, that add force, stop Ethan, and reflect his trajectory. The reflection cube however doesn’t have a noticeable effect on the character. Here is my Code, a method for a OnCollision Function:
Vector3 HitAngle = collision.rigidbody.velocity;
Vector3 reflectAngle = Vector3.Reflect(HitAngle, Vector3.forward);
collision.rigidbody.AddForce(reflectAngle * 3)
I even multiplied the returned Vector3 by 3 to try and make a noticeable movement in the character for the player to see. With its many problems Ethan Golf was still semi functioning and the player could launch Ethan and push him different directions. The level though is barely achievable with Ethan glitching out on world bounds due to excessive force 9/10 times.
- Blender Foundation. (2017). blender.org. [online] blender.org. Available at: https://www.blender.org/
- MakeHuman Team (2017). MakeHuman | Open source tool for making 3d characters. [online] Makehuman.org. Available at: http://www.makehuman.org/
- Unity Technologies. (2017). Unity – Scripting API: Vector3.Reflect. Docs.unity3d.com. Retrieved 2 May 2017, from https://docs.unity3d.com/ScriptReference/Vector3.Reflect.html