Moving an arm with a mouse

Started by
2 comments, last by swiftcoder 6 years, 2 months ago

Am a new game dev and I need the help of you (the experts)

While making the game I had one main problem,

In my game, the player moves his mouse to control the direction of a sword that his character is supposed swings against other players,

the problem is that I don't know how to program the hand to move according to the mouse. 

I will be grateful if someone can give me a helping hand on how to code it or a general idea of how this thing can be programmed on unity ^^.

Advertisement

Basically you' could start in a way similar to how a FPS camera works.

So, in the local space of the player, rotate around the up vector by horizontal mouse movement and around the side vector by vertical mouse movement.

However, this controls just the direction at which the straight sword points from the shoulder. There is no easy way to handle more detailed movements coming additionally from the wrist to control orientation of the sword from that point, because a mouse has only two axis. You would need something like a VR controller.

Or you work out a system that behaves natural and as intended most of the time. For this you need solid experience in solving geometric problems involving 3D rotations, a simple IK solver, some physics. You could look at a video of Kingdom Come Deliverance, and if you have no idea of how they might do this, then you won't get results good enough for a realistic game i guess. I'll end up being more kind of fun (like Fruit Ninja).

That's a pretty open-ended question. Also probably not related to AI - I'm moving you to the Gameplay Programing forum.

First off, is this a 3D game with a first-person perspective? If the mouse is controlling the character's sword, then how does the player control where they are looking?

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

This topic is closed to new replies.

Advertisement