Day 19, Bug fixing and Personal Project1.3; Anim Controller Script + Raycast: Hitinfo

Ji Soo Ahn
4 min readDec 11, 2020

In the past few days, our team Lead, Dan had been putting together a lot of useful information, not only for the focus-team but also for the rest of the GameDevHQ interns. After our recent workshop of Raycast by dan, he then expanded to Box cast and Circle cast. According to examples of if Raycast was used within our space shooter to detect the opposition/object and to auto pilot a destroy, the box and circle cast held a sizeable shape that represent the attached object’s view-point. Thus for an example, if a laser was shot towards the enemy, the enemy could possibly detect within the shape in front of itself and dodge the laser coming forward to it. Also, if any pickup was to enter the shape of the attached, then a player can possibly learn to pull those objects and absorb the pickup powerups. So you are ultimately detecting the collider than the vision of an object. And the best part? Its codes are easily interchangeable without much editing. So depending on the needs of the programmer, s/he can then easily modify the code to best-fit of its use. So, I had been going through the script, cleaning up the last of the shooter codes, some pseudo codes and comments left for myself, deleting unnecessary mutes that I had written in back up of codes before making changes in case the changes somehow breaks the rest of the codes as I’m still blocked from the github for high maximum capacity file of 100mb. I’ve been going through the github crash courses, so hopefully I’ll find a fix soon. If you want to visit Dan’s tutorials on some of the stuff we went through in our team workshop, feel free to visit his medium devblog at:

Now.. a little more on my personal project.

In case you make all your animations in one, you can now separate by the time frame in your inspector
When you divide frame on your animation by the time, they look as such in your project tab for convenience
you can add an animator with bools + triggers(other options: float, int)

In the above cases, upon entry of the animator, the Hand will be drawn into the animation and it will loop on the Hand_idle where it goes up and down in small increments to recreate the normal breathing and body movement. You have to think about how you want to make these transitions. As for me, the hands are drawn when the object spawns then goes into the idle position. When the player starts to walk, it will transition to the walk and if it stops, back to the idle or to a run, when a player decides to run. I didn’t feel the need to change from Run back to Walk. That is because when a player stops from running, it will automatically revert to idle and when initiating the walk, it will simply transition back to walking.

And at “any state”, a player can initiate the attack by pressing a button and it doesn’t have to go through any of the above connected transition to activate.

you can add transitions between the frames (detail)

In this case, I unchecked the ‘Has Exit Time’ which means that you don’t have to go through the entire animation frame in order to move onto the next transition. and transition duration is set to a value of 0.1 in order to get the smooth transition so it doesn’t look like you don’t suddenly get loss of frame, transitioning between movement. Conditions add so that when walking has stopped, it returns back to the idle movement.

Implement these transitions through codes

I had a code start at isTryingtoAttack(); and when it’s != isAttack, then it initiates the attack by doing the above. runs isAttack to true, and run the animation. A little delay was added in between the time that the animation is playing so that the movement is broken into controllable frames.

Hit is active and hitinfo is called to get the colliding object

So at the time of swing, if anything collided through raycast, its information is called to hitInfo. This case, the object colliding with the movement can be called to put the damage effect and furthermore.

Now, with the space shooter behind, and some of the needed personal project functions quenched, back to the curriculum and new learning on cinematography. I had a bit of challenges putting through cameras (yes multiple) and learning to stack them so that fps view is more natural and scene doesn’t seem broken. I am excited to move on forward.

--

--