Kludging as a Creative Approach to Technology
A Journey to Realizable Technology
Inspired from my favorite mobile game, Blue Archive, which has a function to pick a character then drag it along the player’s cursor, I decided to build an environment to pick a rag doll following the ray casted mouse cursor. Therefore, I had to make a diagram to figure out the flow of mechanism.
First of all, I had to import a rigged free character asset from Unity Asset Store then, implant rag doll structure into it.
After that, I built a script to grab the doll away from the floor. At this moment, my goal seemed to be around the corner. Therefore, in order to make changes to this Portal-like script which has a first-person-perspective with a ray cast in the middle of the screen to grab an object, I tried to mimic my inspiration that has a fixed screen where the player can only pick up the object without rotating camera.
However …
It was always encountering with a glitch for the loss of an object reference set to an instance of an object.
Even though I tried to figure out more than 50 hours, it always returned to zero without any progress.
So, I had to find out those who were professional in Unity and fortunately, my elder brother introduced me his friend who is working in a game company mainly with Unity.
First of all, the main problem of null reference was attributed to the `holdArea
` which was for Portal-like function within FPS system.
Secondly, due to short time to spare within deadline, I had to make clear what technology I’m apparently aiming at. That led me to reduce my goal to pick up the doll instantly within a certain height then move along the ray casted location in the 3D world.
Hence, I had to make a controller into an empty 3D object with a serialized field for target, the rag doll. Furthermore, a script for the target doll had to be installed not only into the empty object but also into the doll. In the meantime, essentially, I changed my ray cast from ScreenToWorldPoint to ScreenPointToRay.
Finally,
my goal became realized.
Lessons
Make sure to set the relations among controller empty objects and controlled objects.
As long as you use input devices, it always accompanied with ray casting.
Need to be familiar with the formula of C languages and the systematic flow of Unity.
It is not over till it is over.
Turn your phobia on learning technology into a chance to master it.
Based on a myriad of trials and errors, it is crucial to ask help from others bravely.