You can read the rest of this online course here:

# c#

There are 22 posts filed in **c#** ( this is page **1** of **3**).

# Inverse Kinematics for Tentacles

This post continues our journey in the depth of Inverse Kinematics. In this tutorial you will learn how to apply this powerful technique to create realistic tentacles.

The other post in this series can be found here:

- Part 1. An Introduction to Procedural Animations
- Part 2. The Mathematics of Forward Kinematics
- Part 3. Implementing Forward Kinematics
- Part 4. An Introduction to Gradient Descent
- Part 5. Inverse Kinematics for Robotic Arms
- Part 6.
**Inverse Kinematics for Tentacles** - Part 7. Inverse Kinematics for Spider Legs

At the end of this post you can find a link to download all the assets and scenes necessary to replicate this tutorial.

# Inverse Kinematics for Robotic Arms

After a long journey about the Mathematics of Forward Kinematics and the geometrical details of gradient descent, we are ready to finally show a working implementation for the problem of inverse kinematics. This tutorial will show how it can be applied to a robotic arm, like the one in the image below.

The other post in this series can be found here:

- Part 1. An Introduction to Procedural Animations
- Part 2. The Mathematics of Forward Kinematics
- Part 3. Implementing Forward Kinematics
- Part 4. An Introduction to Gradient Descent
- Part 5.
**Inverse Kinematics for Robotic Arms** - Part 6. Inverse Kinematics for Tentacles
- Part 7. Inverse Kinematics for Spider Legs

At the end of this post you can find a link to download all the assets and scenes necessary to replicate this tutorial. Continue reading

# Implementing Forward Kinematics

This tutorial continues our quest to solve the problem of **forward kinematics**. After exploring a mathematical solution in The Mathematics of Forward Kinematics, we will see how to translate it into C# for Unity. The next tutorial, An Introduction to Gradient Descent, will finally show the theoretical foundations to solve **inverse kinematics**.

The other post in this series can be found here:

- Part 1. An Introduction to Procedural Animations
- Part 2. The Mathematics of Forward Kinematics
- Part 3.
**Implementing Forward Kinematics** - Part 4. An Introduction to Gradient Descent
- Part 5. Inverse Kinematics for Robotic Arms
- Part 6. Inverse Kinematics for Tentacles
- Part 7. Inverse Kinematics for Spider Legs

At the end of this post you can find a link to download all the assets and scenes necessary to replicate this tutorial.

# The Mathematics of Forward Kinematics

This tutorial starts our journey into the world of **inverse kinematics**. There are countless ways to approach this problem, but they all starts with **forward kinematics**.

Inverse kinematics takes a point in space, and tells you how to move your arm to reach it. Forward kinematics solves the opposite, *dual* problem. Knowing how you are moving your arm, it tells which point in space it reaches.

The other post in this series can be found here:

- Part 1. An Introduction to Procedural Animations
- Part 2.
**The Mathematics of Forward Kinematics** - Part 3. Implementing Forward Kinematics
- Part 4. An Introduction to Gradient Descent
- Part 5. Inverse Kinematics for Robotic Arms
- Part 6. Inverse Kinematics for Tentacles
- Part 7. Inverse Kinematics for Spider Legs

At the end of this post you can find a link to download all the assets and scenes necessary to replicate this tutorial.

# Nested Coroutines in Unity

This tutorial shows how to make the most out of coroutines in Unity.

- Introduction
- Part 1. Synchronous Waits
- Part 2. Asynchronous Coroutines
- Part 3. Synchronous Coroutines
- Part 4. Parallel Coroutines
- Conclusion

# Iterators in C#: yield, IEnumerable & IEnumerator

Iterating over lists in C# is often done using for loops. This tutorial shows how the foreach construct can be coupled with the yield statement to create more elegant and safe code.

- Introduction
- Part 1. Implementation
- Part 2. The yield Statement
- Part 3. Limitations
- Conclusion

# Fading Sprites in Unity 5

This tutorial shows how to extend the class SpriteRenderer to support intuitive, painless fading transitions. Despite referring to sprites, this approach can be used to easily animate any property of a game object in Unity.

- Introduction
- Step 1. Extending the SpriteRenderer
- Step 2. The Coroutine
- Step 3. Invoking the Coroutine
- Step 4. The Callback
- Conclusion

The link for the script used in this tutorial is at the end of the post.

# Simplified Collision Geometry

This tutorial shows how to automatically generate simplified colliders for 3D models imported into Unity. The tutorial uses Google SketchUp as an example, but its knowledge and code is agnostic to whichever modelling tool you are using.

- Introduction
- Step 1. The Problem
- Step 2. The Solution
- Step 3. Custom Editor
- Step 4. Improvements

# Asynchronous Serial Communication

In a previous post, How To Integrate Arduino With Unity, we have shown how data can be sent and received through the **serial port**. The main problem encountered was dealing with the latency and the delays that communicating across different devices introduces. The solution proposed in that tutorial used a **coroutine**; decoupling the device communication from the game logic attenuates the problem, but it doesn’t remove it. The main problem is that, despite the name, Unity coroutines are not *really* executed in parallel with the rest of the game. Unity, by design, is not **thread safe**. This means that true parallelism is intentionally avoided by the engine, as it could result in race conditions. To solve the problem of the communication between Unity and Arduino, once and for all, we need actual threads.

- Step 1. Creating the Thread
- Step 2. Callbacks and Queues
- Step 3. Queue Communication
- Step 4. Thread Loop
- Step 5. Improvements
- Conclusion