Rotate at hip

Picture this…
One inch tall image (on 800*600) of a soldier, side view(profile) 2D. From waste down, standard animation of a few gifs for running, walking, crouching, jumping…etc.

From the waste up, I want to use the mouse…where ever the mouse curser is at, I want the barrel of the weapon in hand(pistol, rifle, etc.) to point to the mouse cursor with some of the body as well. Any thoughts on the best way to do this?

A and D key will move you right or left and mouse controls aim and firing in a side scroller.

How about seperate images for the upper limbs and a couple of images for the torso rotating, then you could rotate/string them together to get the correct facing angle (some what like rag doll ku fu, but without the bouncy-ness http://www.lhtimes.com/ragdoll.html ) :slight_smile:

great idea! I checked out that site as well. How would you rotate the final “limb” of the doll? AffineTransform in order to match the exact mouse to pivot point angle?

Well I’d use OpenGL and draw a rotated quad, but pretty much the same thing. If you’re doing it with Java2D you might want to pre-rotate your sprites though, either with individual drawings or by rotating a small set of sprites on startup.

Thanks again. I may try the pre-rotate image version…my problem is that I neve know how many to make, so I end up useing AffineTransform.rotate(#.#)

When the mose moves and you click to shoot, the bullet needs to go along the path from origin to and thru mouse location at time of click.

I have no OpenGL knowledge, started looking at LWJGL, but can’t get it to compile or run on my dev box(still tyring to figure that out), so I wil ldo J2D exclusively. If I can get a smooth version, I may switch my GT6 ship movement to rotated images instead of AffineTransforms.