Tags: tutorial

Stretchy Objects in Unity 3D - Part 2

Bounding forward with our tutorial, in this installment we're going to add the ability to tether the end of a Stretchy object to a local point within the target object. That way, if the object is scaled or rotated, the anchor point will move and rotate appropriately. While we're at it, we'll also add distance margins. Our stretchy classes are becoming more interesting and powerful, so we'll need to take some time out along the way to reorganize the code more smartly, both to appease the code gods and to satisfy the modular Unity paradigm.

Stretchy Objects in Unity 3D

A common problem in graphics is drawing a line from one point to another. In games and simulations we often need to do the same thing using a 3D object. In this article I'll walk through the code you need to stretch a GameObject in Unity3D along a single axis so that its ends remain tethered to two objects as they move around in 3D space. A demo project is included!

Syndicate content