Search Unity

[WIP] GearBlocks - Build working physics based machines and mechanisms [DEMO]

Discussion in 'Works In Progress' started by danger726, Mar 24, 2015.

  1. danger726


    Aug 19, 2012
    Body parts

    Time for a long overdue update! I've done a lot over the past two months so I'll have to split this into a couple of blog posts. In this first one we'll look at the character models I've been working on.

    Crash test dummy

    A while ago I added knuckle joint connectors which, along with the ball and socket connectors, can be used to construct simple rag-doll characters. This got me thinking, it would be cool to have some proper body parts with the connectors built in to them, which could be assembled in the game to make more convincing humanoid rag-dolls. I figured a crash test dummy would best fit with the idea of being made up of rigid body parts with exposed joints.

    The first thing I had to decide was what body parts would be needed. I wanted to allow for flexibility of movement, but not have so many parts that building a character in the game would be unmanageable. I settled on the following 11 parts:-
    • Upper and lower torso (initially I had a single torso part, but in the end I had to split it to allow for animation - see "Player character" below).
    • Head.
    • Upper and lower left arm.
    • Upper and lower right arm.
    • Upper and lower left leg.
    • Upper and lower right leg.
    The second problem to solve was the joint connector locations and body proportions, this was tricky as I wanted to keep all the connectors on unit boundaries (or failing that, half unit) relative to one another, while keeping the dimensions of all the body parts in proportion.

    After these decisions were resolved it was time to fire up Blender and make some parts, here's what I ended up with:-

    ...and once assembled together:-

    I added attachment points on the hands so that other parts such as axles can be connected to them:-

    ...and because the body parts are compatible with everything else in the game, you can create all sorts of nightmarish stuff!

    Player character

    One of the longest unresolved design problems in GearBlocks has been the player character model, the skinned models in the game at the moment are just placeholders and were well overdue to be replaced. The trouble is, I couldn't decide what the player model should look like, or how to have it fit in aesthetically with the rest of the "GearBlocks world".

    Then I thought, now that a humanoid character can be built in the game from body parts, why not utilise this for the player too? This will require implementing a way for a character built in game to be selected and used as the player model.

    To explore this idea, I decided a crash test dummy wasn't good enough, I wanted to have a proper human. Inspired by action figurines, I tried to make the body parts so that their joints, although exposed, are not overly obvious. I went with a stylised appearance for the face and hair, this was partly due to the limitations of my modelling skills, but I also think this look fits the visual style of the game quite well. Here's what I have so far:-

    Note that this is all still a work in progress, in particular the clothing and feet need some more refinement, as do the skin and hair shading. At some point I'd also like to add a female variant, and other skin tones. Plus it would be cool to have accessories (such as crash helmets). I did make the clothing paintable however, which allows for creating somewhat unique looking characters:-

    ...and of course you can mix and match with the crash test dummy parts!

    I haven't yet implemented the system to make a built character "become the player", this will need to hook up the body parts to the appropriate animated bones (replacing the old skinned mesh altogether). For now I've hacked something together so I can test these character models out with the player animation system to make sure they work properly:-

    The animations you see here are all new, in fact most of my time over last two months has actually been spent on the player animations, and this will be the topic of the next post...
    Last edited: Aug 2, 2019
  2. danger726


    Aug 19, 2012
    Player animations

    The janky placeholder player animations that have been in the game for ages were long overdue for replacement with something better. Over the past couple of months I've been spent working on sourcing better animations, setting up the animation blending and transitions, and then driving that based on game state.

    I worked out that I needed animations for:-
    • Standing idle.
    • Standing jump.
    • Turn left / right in place.
    • Locomotion (forward, backward, strafe left, strafe right) at various speeds from walking to sprinting.
    • Walking and running forward jumps (for jumping while moving backwards or strafing I just use the standing jump animation, as I couldn't find anything more suitable).
    • Seated.
    • Tool holding (right arm held out) in up, forward, and down directions, blended based on the camera view direction.
    I don't have the budget to pay for an animator, so it was quite challenging to find suitable animation content to meet these requirements. In the end I was able to get by with a combination of a paid animation pack from the Unity asset store, some free animations from, and creating some animations from scratch.

    It was a fiddly process to set up the animation state machine in Unity to get all these motions blending and transitioning nicely, but I'm happy with the final outcome:-

    First person mode

    I've now enabled the animated player character in first person mode, the downside being that this can cause problems with bits of the body poking through the camera near clip plane, not the easiest thing to avoid especially if the camera is set to have a wide field of view.

    To solve this I had to do a few tricks to offset the character and camera based on the view direction. It also imposed restrictions on the range of motion of the upper torso and arms and therefore what animations I could use. The end result is well worth it though:-

    In first person mode the camera is now attached to the character's animated head position, this adds a lot of life to the camera movement (e.g. "dipping" after landing from a jump), and makes a big difference to the feel of the game:-


    Once I had the player character animations working well in both first and third person modes, I moved on to the task of adding some tool models and attaching them to the player's hand. Now, as the player selects between the different tools (e.g. builder, painter, etc.), the transition between them is animated, and the models are swapped. Right now I just have simple placeholder models for the tools, and I plan on adding some transition sound effects, but here's what it looks like so far:-

  3. unslinga


    Jul 12, 2017
    Following this game closely!
    Will you be adding logic-type blocks to control servo motors and stuff programatically?
    also, will hydraulics like pistons and high torque motors be added?
    Please make it so that the ballsockets can be used as U-joints
    Last edited: Sep 15, 2019 at 2:30 PM
    danger726 likes this.
  4. danger726


    Aug 19, 2012
    Thanks for following!

    Yes, my plan is to eventually add some form of programmatic control as you suggest, along with switches and sensors, all connected together via the linker tool.

    As for hydraulic pistons and universal (CV) joints, they're done already in the full version of the game that I'm currently working on.
  5. unslinga


    Jul 12, 2017
    Any chance there will be a new update to the demo soon, or are you looking at releasing the game fully?

    Also, there is a critical bug in the 0.5.7019 Demo, when exiting a seat, sometimes it flings you high up in the air, or several hundred meters away from the creation
    Last edited: Sep 16, 2019 at 8:04 PM