Middle of the day pre-beta post
|
We’ve ran into a bit of a snag right now which means i can’t start working on handling spells inside the player class until the spells have been added. Because of this and the fact that i might have to stay a bit late tonight to get everything done for tomorrow’s playtesting i’m writing a blog post in the middle of the day. We had a slow day yesterday, the only thing i managed to commit was the player actually rotating towards the current target when casting a spell while locked-on. This was to prevent the player to shoot spell into their own face when casting a spell and running away from the target. Nothing too fancy involved and i practically only ripped the calculations to calculate the spell rotation when casting on a locked-on target. Something that did require some fancy mathematics was my next task which i started last evening but didn’t manage to finish. (Due to my own stupidity) The task was to make the camera actually care what direction it is pointing when finding lock-on targets. It was a sad reminder that i didn’t remember much of the math course we had this fall. Using online resources and some help from the other programmers i tried out several different methods but couldn’t figure out how to make it work. Today i resumed work and tr-attempted all the methods i tried yesterday and eventually found out my mistake. Instead of checking the angle between the Camera and the Target, i have been comparing the angle between the Camera and the Player. Even then there was one last thing i needed to take into consideration, the two vectors i wanted to find the angle between wasn’t the two objects’ positions, but rather the first vector was the forward vector or the camera, the second vector was the vector between the camera and the target. Luckily i had found the formula to do this while searching online resources. The cameras forward vector is simple to obtain, the vector between the Target (current monster checked) and the camera was obtained by subtracting the second from the first. Once dealing with directional vectors rather than positions the only thing left is to get the Dot product and run Arccos to get the angle in degrees. If the angle is lower than 60, the target is further considered for being locked unless a better target is found. The reason i chose 60 is because that is a standard Field of View (although i haven’t checked the camera we’re using yet.) . In any case this provides satisfying results. One thing that struck me was that i could use this angle calculation to check which target is closest to the center of the screen, something which could be useful and be taken into consideration when prioritizing targets in the future. Today i have been managing minor things once that got done, most notably adding a function which will allow icons to be placed in the slots on top of the HUD when lining up spells in Harakat. As for right now we have ran into a snag in our planning where every one of the programmers are working on the same file at once, which means only one person at the time can do proper work on it. I’ll probably get food and stay working a later than usual to add the resources and functionality needed for the new spells. |
