I have been thinking of making my own advanced sword system for perhaps a battleground game, however, I don’t want it to be any ordinary sword system. If any of you are familiar with Lightsaber Battles 2, the sword system there is absolutely AMAZING.
Here is what I like about it:
You can lock onto a specific person
You can block by determining which side your opponent is aiming at
It’s stylish
Does anyone know how this system is even made? I have heard about methods such as IK (Inverse Kinematics), but I am not sure if this is the right approach, given I want to move the arm up, down, left and right just like in the game. If anyone is experienced with this, I’d love to hear your thoughts on how I could approach this.
If you are too lazy to try it in game, here is a video about the system and how it works.
This returns a Vector2. If the mouse moves right, the X will be positive. If the mouse moves left, it will be negative. For the Y, up is negative, down is positive.
Given these values, you could store which direction the player is aiming, and change the UI accordingly
That’s the bare necessity you need to get this system started. However, this won’t replicate to other clients; using a RemoteEvent to tell the server which direction the player is using is a way to fix this.
I’m not exactly sure how the lightsaber system works, but I’m assuming that if a player attacks an enemy, and the enemy is aiming in the same direction, it will block. If not, then it will be an attack. One idea that comes to my mind is having a list of players with their current direction value being updated whenever they fire the RemoteEvent. When an attack is being performed by a player, check the two player’s direction states (both aiming right/left = block, different directions = successful attack).
This is pretty simplified, but I hope it gives you an idea. For the lock-on camera and such, there should be helpful resources around the dev-forum. This stuff seems complex at first, but it truly isn’t in the long run - break them down until they are digestible. Good luck!