Tuesday 17 May 2011

Offspring

I have added the ability for the model to generate smaller versions of itself inside its shell, at the predetermined points. My Blender model actually has all these mini versions in place, and I adapted the mini version object's position/rotation/scale data directly from Blender and it worked like a charm.




The interior parts are chosen at random, as are some other parts, to provide some variety between versions. Mostly it is swapping out a 'filled' spot (something installed) for a 'plugged' spot (something could go here but isn't installed, so there is a space filler) or simply an empty space.

The way I avoid infinite recursion while building these things is to only fill the interior with mini parts when the object is first exploded, which can only happen to the 'master' or top level object. There is a bit of trickery with the front slots, as they are visible even without exploding, so I have dummy objects in there that are replaced seamlessly (*ahem*) with actual mini parts when the object is exploded.

Mouse controls for rotating the model along two axes are now in, along with explode control. RMB and LMB drag respectively. Right now it works based on proximity of the mouse from the screen's centre, but this doesn't create intuitive behaviour since clicking and dragging in a new place causes the mode to snap to the appropriate orientation suddenly. It also requires much more precise mouse positioning. I want to improve it to a method I have used in the past, where the difference between mouseX and previousMouseX is used to determine mouse drag direction, and that is in turn used to modify the value. This means the position of the mouse is irrelevant, just the direction of its movement is important.

No comments:

Post a Comment