torsdag 7 juli 2016

Texturing

In order to be able to apply nice textures to the cart models in Unity, there are some necessary steps to take. If any texture was applied to the finished models, without these steps taken, the texture would appear as "smeared" upon the whole rigid model - creating an uneven and pixelated surface to the model.

To eliminate this issue, we will use UV mapping tools within Maya that create pixel mappings on the faces of the 3D models. The cart models will have their surfaces split into suitable face partitions. The key here is to make sure to include all the face elements of a model, or risk getting an uneven surface mapping that will most likely affect the texture quality later on in Unity.

Cart model after UV mapping applied.
Once the surface has been divided into smaller face parts throughout the 3D model it is time to move on to the next step: checking the quality of the created texture mapping. Luckily, Maya has a neat feature called "checkered tiles" that will display a checker board with various colors, functioning as a generic texture. With this tool it is now easy to spot any uneven splits, size issues, or any other kind of unevenness to edit prior to exporting the texture-ready model. With the checkered tiles mode activated, each face part can easily be moved to a specific checker board for checking consistency with the rest of the model faces.

Checkered tiles mode activated, with each face part visible in the window.

Animations!

A first animation of the roller coaster has now been made using the physics of the Unity engine.
Some small tricks went into making this. During the first attempt to make this animation, some simple collision was put on the wheels of the cart while also using the mesh of the track as its own collision. The cart got stuck constantly so it didn't work out well.

For the current animation, the track has been given a slightly simpler collision mesh by removing the middle part of the original meshin maya.

The track mesh without the center part of the track in Maya.
This was then used as the collision for the track's GameObject in Unity

The track in Unity. The green highlight is the object's collision.
Continuing, The carts' collisions had to work well with this. In order to not have any edges that easily could get caught on the smaller edges of the track, the carts got four spheres as their colliders. Sphere collision is also very fast to calculate which could make the performance better. Two spheres above the rails and two are below the rails of the track to make sure that the cart neither jumps off nor falls through the track. The spheres are all in between the track's two collision rails, making it impossible to go off the track.

Cart and track in Unity with their collisions highlighted in green.
Finally, several carts were connected using spring joints and all present physics materials were given a friction of 0. A force was then added to the carts to accelerate them and a small force was kept on the carts so they wouldn't lose their momentum. This gave the following result:

Animation of the roller coaster using Unity physics.

måndag 4 juli 2016

Cart undercarriage and alternative cart design

The undercarriage was modeled to look similar to the cart found in the design template. The undercarriage consists of four connections between the cart and the track, where each connection has of six wheels that surround the rail in three directions; above, outwards and below. There is also a shock absorber mounted below the head of the cart.

Our cart design template. (source: http://www.coastergallery.com/2009/LaR60.html)
The model for the "wheel" was created by extruding faces from a square primitive until we got the sought after shape that lets the six wheels align correctly with the rail of the track.

Model design for the rail connections of the cart.
The four wheels were places under the cart, attached to the rest of the undercarriage (a simple cube) that also features the shock absorber. The absorber consists of two cylinders, each with a small line indentation around the middle of the cylinder for looks. 

The undercarriage of the cart.
A second design for the cart was also created. It is a variation of the cart that will be at the head of the roller coaster, and will not feature the aerodynamic head. It was created by copying the rear part of the cart and placing it in the front, resizing its width so that both rows of chairs have the same amount of legroom and distance to the handlebars. In order to flip the copied rear half of the cart, we scaled it negatively in the appropriate axis. This changes the normals for the surface, so in order for any future textures to show up on the right side of the surface the normals of half the model were reversed. The final look for both carts can be seen below.

Front and rear cart models.