### How To Move An Object Through A Set Of Points [The Correct Way]

Move An Object Through A Set Of Points
In order to move an objects through various points, we need a way to access those points.
So for accessing them we will use an array of transforms.
We will be using a Co-routine to update the object's position and to help it "Find Da Way".
I'm pretty sure by the time you read this that the meme is long dead.

While going through each point by lerping through each point may seem like a viable option but it leads to results like this:
 Inconsistent speed of movement
This type of movement where it takes the same amount of time to cover the same distance may not be the type of movement you are looking for.
First we will see how to get to this point then learn about the better way of moving stuff.
``````private IEnumerator MoveToSeat(Transform[] path)
{
float t = 0;
Vector2 startPostion;
float distance;
for (int i = 0; i < path.Length; ++i)
{
startPostion = transform.position;
t = 0;
while (t<= 1f)
{
t += Time.deltaTime * speed;
transform.position = Vector2.Lerp(startPostion, path[i].position, t);
yield return null;
}
transform.position = path[i].position; //Making sure flotaing point errors don't creep in
//t value might have overshot
}
}``````
Nothing really important to note here... other than that the Lerp function just takes into consideration the deltaTime value & the speed of movement.
Now we will do it the right way by taking into consideration the distance between the points as well.
``````private IEnumerator MoveToSeat(Transform[] path)
{
float t = 0;
Vector2 startPostion;
for (int i = 0; i < path.Length; ++i)
{
startPostion = transform.position;
float distance = Vector2.Distance(startPostion, path[i].position);
t = 0;
while (t <= 1f)
{
t += (Time.deltaTime / distance) * speed;
transform.position = Vector2.Lerp(startPostion, path[i].position, t);
yield return null;
}
transform.position = path[i].position; //Making sure flotaing point errors don't creep in
//t value might have overshot
}
}``````
Now we get this result:
 Takes longer time to cover larger distance
Just by dividing making the t's increment value smaller.
[Speed = Distance / Time ] : [ Time = Distance / Speed] & thereby we use 1/Time which is the increment value for time(t).
Support Bitshift Programmer by leaving a like on Bitshift Programmer Facebook Page and be updated as soon as there is a new blog post.
For more Unity tutorials go HERE.

### Gift Wrapping Convex Hull Algorithm With Unity Implementation

Convex Hull Algorithm Convex Hull algorithms are one of those algorithms that keep popping up from time to time in seemingly unrelated fields from big data to image processing to collision detection in physics engines, It seems to be all over the place. Why should you care? Cus you can do magic with it and it seems so simple to implement when you first hear about it, but when you start thinking about it, you will realize why it's not such a straightforward thing to do.
Now that I got you interested (hopefully) and now we will see just what a convex hull is.
As you may have noticed a perimeter was made with the same points that was given and these perimeter points enclose the entire set of points.
Now we have to clear up the term 'Convex'.
Convex means no part of the object is caved inwards or that none of the internal angles made by the points exceed 180 degrees.
In this example of a concave shape internal angles go beyond 180 degrees.
What are those red lines for? Well...…

The process of shader optimization can seem like trial and error... in fact, that's how it is most of the time.
Most of the time shader optimizations could be boiled down to educated guesses because each time a shader gets compiled, the GPU driver of that specific hardware is what converts your code into actual machine code, therefore, the machine code generated will be different for each GPU and the driver itself might perform some optimizations on top of your's which won't be available on another GPU, thereby making it difficult to have a standard way of writing optimal shader code.

So the best way to know for sure is to actually test it on the hardware you are targeting.
With that said, Here are some universal best ways of getting your shader to perform better.😅 Do Calculations On Vertex Shader The most commonly used case for this is lighting, an example would be Gouraud lighting, where lighting calculations are done per vertex but at the loss of quality.

Some calculatio…

### Fortnite Procedural Construction Animation Shader

Fortnite Construction Shader This shader is loosely based on the one that was presented by the Fortnite developers in their GDC talk: Inner Working Of Fortnite's Shader-Based Procedural Animations.

Here is what we will end up with:
This technique requires you to author the 3D model in a certain way, More or less how those Fortnite developers did.
So we need the authored 3D model and the shader that uses data we get from the model to achieve the desired effect.

There are some nuances here and there so make sure you don't miss out on the details.😗
The first step will be preparing the 3D model and putting in the required data. I used Blender 2.79 but any 3D modeling software would do.
3D Model PreparationModel It
Apply Vertex Colors: For the direction of flight
Each color is a component of a vector (x, y, z). This will be considered as local space.
Values range from -1.0 to +1.0 for each component.
Negative values are achieved by using values of less than 0.5 and positive values wi…

### Visual Upgrade - Unity Asset Store [ September, 2018 ]

Visual Overhaul - Assets That Turn Mediocre Into Drool Worthy *Note: These assets are not arranged in any way, no comparison is done. They are just really cool assets that will help make your game look at least a bit better. 😁
8. Bat Particles
7.GPU Instancing Animation
6.Colored Pencils
4.Sleek Render: Mobile Post Processing
3.1000+ Effects pack
2.COLR - Coloring Redefined
1.AllSky

Check out more such Unity Asset Store Gems : HERE
Don't forget to share these wonderful assets with your colleagues and friends.
Support Bitshift Programmer by leaving a like on Bitshift Programmer Facebook Page and be updated as soon as there is a new blog post.