SVG Game Engine – Bounds and Picking

Tonight I spent some time setting up the preliminary classes I’ll need for a

Ninja drawn with AA in Release mode.

Here's a shot of just the ninja rendered with 6xAA in the Release build.

skeletal animation system.  It’s all quite straight forward stuff, but just as a reference I have been using this excellent tutorial.

In the same vein, I also stumbled across some C# code for various types of 2D two-bone inverse kinematics solvers.  The 2D IK problem is simple enough for two bones that one can solve it analytically and come up with a pretty fast solution (certainly faster than cyclic coordinate descent, which is pretty fast).  I had planned on implementing either CCD or trying to do a Jacobian Transpose IK, but I think this should be sufficient for my needs, and the license is very liberal (free to use for commercial, just retain the license and a note attributing the author – nice).

Anyway, after setting up the classes for the skeletal animation and getting those compiling okay, I decided to go ahead and start dealing with the picking code.  Of course, this led to using the ShivaVG functions for getting the bounds of a path.  After setting it all up I was getting some odd results, so I eventually futzed around with the bounds calculation and eventually got it all sorted out.

Ninja with Bounds Debug Draw On

Can toggle debug drawing of bounds on and off with left control.

Subtract the amount that I am translating the ShivaVG c

ontext from the X and Y coords of the mouse click.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s