Leap Motion: Grab and Release Blueprint

GrabAndReleaseThe above script can be used to pick up objects using the leap motion controller.

  1. Create a new blueprint class called Pickable Object.
  2. Add a mesh element to the blueprint. In the example I used the Epic Games mug that comes with the Realistic Rendering environment.
  3. Using an Event OnActorBeginOverlap we detect any overlapping actors. By casting this to a leap motion actor, we check to see if the overlapping actor is a leap motion actor.
  4. Next we query the grab strength of the leap motion actor. If it is greater than 0.8 we attach the Pickable Object actor to the palm bone of the leap motion actor.
  5. Finally we set a timer to test when the detach condition is met. (Grab Strength is less than 0.2). When this is met, we detach the Pickable Object and stop the timer.

This is just one method. There are tons of ways to achieve similar results. Once setup its easy to change the variables and extend this blueprint to do more than just attaching an object.  One thing to note is that pinch strength is more reliable than grab strength, it’s best to experiment though as each case is different.

Posted in UE4 | 3 Comments

Lego Spawning Physics Gun

Demo of a Lego Brick Spawning gun in CryEngine 3. Created a custom weapon class in C++. The engine runs well even after spawning hundreds of physicalised entities. The frame rate stays high no matter how many entities are spawned. The only thing that slows down is the rate at which the physics updates.

Posted in C++, CryEngine | Tagged , , , | Leave a comment

Creating A Custom Car in CryEngine 3 Part Two: Creating the Vehicle Definition in CryEngine

Creating A Custom Car in CryEngine 3

Part Two: Creating the Vehicle Definition in CryEngine

Introduction

In this tutorial, I will be covering how to create a vehicle definition in CryEngine by writing a .xml file for the Vehicle.  The easiest way to do this is to modify an existing vehice .xml.  We are going to use the HMMWV.xml as a starting point and edit individual <Tags> one at a time to solve specific problems.

I have found it easier to edit the .xml in a text editor than to use the Vehicle Editor.  If you want to try the Vehicle Editor out it can be found under the View>Open View Pane menu.

  1. To get started we will add a reference to our custom vehicle model.  Under the <Parts> tag find the following line.  
    <Animated filename="objects/vehicles/HMMWV/HMMWV.cga" filenameDestroyed="objects/vehicles/HMMWV/HMMWV_destroyed.cga" id="idModel"/>

    Replace the filename with your custom model.

    <Animated filename="objects/vehicles/Impala/Impala.cga" filenameDestroyed="objects/vehicles/Impala/Impala_destroyed.cga" id="idModel"/>
  2. At this point you should be able to test the vehicle in the editor.  Select the Entity menu from the RollupBar and select your vehicle from the Vehicle folder.
    RollupBar

    RollupBar

    Assuming everything worked you should be able to jump in to the game, walk up to the car and press F to enter.  The exact entry location of the vehicle may be a little off as it is still set for the HMMWV.

  3. The first thing that you will notice is that the character is floating in space.  This is because we haven’t set the drivers position yet.  The sitting position is defined by a dummy object in the .Max file.  Open your vehicle and add a new dummy object called passenger01_seat_pos.  This should be positioned slightly above the drivers seat.  While you have Max open, you may want to add dummy objects for the other seating positions and entry points etc.  For my car I was only interested in having a single seating position.  The dummy names aren’t important other than the .xml values must match the dummy name exactly.  Make sure that any dummy objects you have added are linked to the base dummy object and re-export.
  4. Now the player character should be sat in an appropriate position.  The next thing that we will deal with are the Lights and the Exhausts.  The process for setting each of these up is the same and is very simple. First add a new <Part> under the <Parts> tag.  The following example is for the Left Headlight.
    <Part name="headLightLeft" class="Light" component="headLightLeft" helper="headLightLeft">
     <Light type="HeadLightFlare" id="idHeadLightFlare1"/>
     </Part>

    The <Part> uses a <Helper> to set the position of the light.  This is set under the <Helpers> tag.

     <Helper name="headLightLeft" position="-0.65,2.3,0.55" direction="0,1,0" part="hull"/>

    The benefit of having this value in the .xml is that you can easily tweak it without having to re-export from the .max file.  Simply adjust the values until you get the desired result.  Take a look at the HMMWV.xml for more examples of the different <Light> properties and how to set up the exhausts.  If you want to use different particle effects for the exhausts look for the <Particles> tag at the bottom of the .xml file.

  5. Finally you will want to take a look at the properties for the wheels.  These can be found under the <Parts> tag.  
    <SubPartWheel axle="0" density="0" damping="-0.7" driving="1" lenMax="0.3" maxFriction="1" minFriction="1" stiffness="0" suspLength="0.25"/>

    Try different values for the stiffness, friction etc, as they can dramatically change how the vehicle drives.

  6. Study the HMMWV.xml to see how the rest of the tags are used.  Once you have the basics down, everything else is easy to modify.
Posted in 3D Models, CryEngine | Tagged , , , , , | 2 Comments

Creating A Custom Car in CryEngine 3 – Part One: Setup and Exporting from 3ds Max

Creating A Custom Car in CryEngine 3

Part One: Setup and Exporting from 3ds Max

Introduction

In this tutorial, I will be covering the basics of taking a car model from 3ds Max and setting it up ready to be used in CryEngine.  This is a very simple process, but there are a number of pitfalls to be avoided along the way.  For the purpose of this tutorial we shall keep things simple and not worry about animations, destructible panels etc.

Setup in 3ds Max

  1. The car Model should be made up of five separate objects.  This should be the car body and four wheels.   Name the objects Body, wheel1, wheel2, wheel3 and wheel4 as shown below. These names are important as they will be used by the vehicle script. Make sure that the car is pointing up and is in line with the Y-axis.
    Naming and orientation of objects.
    Naming and orientation of objects.
  2. Make sure that the entire car, including the wheels is above the Y-axis.
    Car Position
    Car Position
  3. Reset XForm on all objects and make sure that the pivots are setup properly.    The pivot of the wheels should line up with the inside edge and be centered about the wheel.  For the body make sure that the pivot is set to 0,0,0.
    Wheel Pivot Alignment
    Wheel Pivot Alignment
  4. For each of the wheels add a user defined property of wheel.  User defined properties can be added by right-clicking the object, selecting Object Properties… and selecting the User Defined tab at the top of the dialogue. Simply type wheel in the User Defined Properties box and click OK.
    User Defined Properties
    User Defined Properties
  5. Create a proxy for the body of the car.  This can be as simple as a chamfered box.  For the underside of the proxy it is a good idea to avoid sharp corners as these can cause the car to become stuck on the terrain or other scene objects.
    Body Proxy
    Body Proxy
  6. Create a proxy for each of the wheels.  Create a cylinder with 16 sides and move the pivot of the cylinder to the inside edge of the object.  For larger wheels you may want to use 24 or 32 sides.
    Wheel Proxies
    Wheel Proxies
  7. Create a multi-sub object material with enough channels for your car.  Create a sub material to be used for the physics proxy.  Make sure that all objects have a valid material channel id set.  For the impala model I created 10 sub materials including Paint, Chrome and Glass.
    Multi Sub Material
    Multi Sub Material
  8. Create a dummy object and position it at 0,0,0.  Link the body to the dummy and the wheels to the car body.  Finally link the body proxy to the body and the four wheel proxies to the wheels.  It is a good idea to leave the linking of objects to the last step as 3ds max has a tendency to break the model if you adjust the pivots or reset XForm on a linked model.
    Schematic View
    Schematic View
  9. Now select the dummy object and add it to the exported files list.  Export the file as a cga and create the material in the usual way.  For details on creating materials and exporting cgf/cga files see the Crytek documentation.
    Export
    Export Settings

In the next part of this tutorial I will cover creating and editing the vehicle definition in CryEngine.

Posted in 3D Models, CryEngine | Tagged , , , , , | 1 Comment

19th Century Camera

19th Century Camera

An early example of a 19th Century Wet Plate Collodion Camera. From around 1871.

Posted in 3D Models | Tagged , , | Leave a comment

K2 Telephone Box

K2 Telephone Box

An accurate model of a K2 Telephone Box. Modelled using the original designs, available from the V&A Museum.

Posted in 3D Models | Tagged , , | Leave a comment

Rocket Rim and BFGoodrich Radial T/A

Radial TA

This is my first ever wheel and tire model.  The tread pattern was a real challenge to model.  I created a single section of tread then created an array of 32 tread sections.   With the tread stretched out in a long line, I attached the sections and welded the edge vertices.  To finish up I used the bend modifier to roll the flat tread pattern in to the final wheel shape.  There was a little bit of experimentation and I had to redo bits of the initial tread section to get everything to weld neatly.

I also created a low-poly version of the tire and used XNormal to bake out a normal map.

Posted in 3D Models | Tagged , , | Leave a comment

Key Model

Key Model

Highly detailed model of a door key. Modelled using sub-division. 100% quads.

Includes Key Ring Model.

Posted in 3D Models | Tagged , | Leave a comment