x


Fighting Game - Aiming attack animation at mouse cursor?

Hi guys, I'm planning out a fighting game. The game will be a 2d sidescroller combined with arcade fighting type controls but using the mouse to aim your attack. All characters/enemies will be 3D rigged/animated models. If I make an animation for swinging a scythe (example) horizontally, (for the purposes of clarity, if I say 'horizontal' I mean there is no vertical component to the attack, not that the swing happens on a flat horizontal plane) how can I make it so that horizontal swing is aimed at the mouse cursor? Of course I could aim some of his spine/chest joints gradually towards the mouse, but that will end up making weird poses. I could also have a vertical horizontal (swinging horizontally, but aiming straight up at 180degrees from the ground) swing, a diagonal horizontal, and a horizontal horizontal.

Hope that isn't too confusing. I want the swinging animations to aim at the cursor and would love if someone could provide a starting point. I know I'll have to raycast from the mouse position to the world but this is more about getting the animation to point at the location.

Cheers

more ▼

asked Jul 02 '12 at 09:15 AM

Vire gravatar image

Vire
61 9 14 16

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Hmmm, not at all easy - you are asking for an Inverse Kinematic solution I think where the animation is retargetted at run time. Looks like that is coming in 4 Pro, but there arent any solutions I've found and I'm half way through writing one, but may give up due to version 4.

Your best bet might be to rotate the bone near the chest having worked out the relative angle between that one and the scythe at the moment of impact. Full IK means working back from the end effector (tip of the scythe) though all of the bones in the body adjusting them to look natural (and taking into account the limited degrees of freedom of each bone).

more ▼

answered Jul 02 '12 at 09:20 AM

whydoidoit gravatar image

whydoidoit
32.9k 11 23 98

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3769
x156
x61
x26

asked: Jul 02 '12 at 09:15 AM

Seen: 633 times

Last Updated: Jul 02 '12 at 09:20 AM