Creating a round end for the line rendered by the stylus

0 votes
asked Jun 18 by Chief (16 points)
I have been asked to develop a rendered line from the Stylus that has a rounded end.

I am using Unity 17.4 editor with C#.

What I am looking to do is add a small round circle to the end of the stylus length.

Thanks!

1 Answer

0 votes
answered Jun 18 by AlexShorey (263 points)

Hi Chief,

There's no right or wrong way to do what you're asking. It ultimately depends on how you want your stylus to look and act. The best I can offer is advice on how we tend to construct our own.

We usually go for a two model solution. One for the line, and one for the end. The line model is also given a uniform width. Both of these choices give us the option to adjust the stylus length dynamically without it appearing to distort. We only stretch or shorten the line model, then add the tip model, at its normal length, to the end.

Say you want to point at an object and have the virtual stylus tip contact exactly on the surface of that object. You'd do a raycast operation, get the returned length, subtract the length of the tip, and scale the line model to cover the difference.

One additional piece of advice. I recommend going a little farther than just rounding off the tip. In most circumstances, virtual stylus tips are pointed away from the user, so they won't see the rounded detail. Adding additional features, like a color change, or a collar ahead of the tip can help visually distinguish it.

hope that helps!

Alex S.

...