torsdag 7 juli 2016

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.

Inga kommentarer:

Skicka en kommentar