Vincent Taylor

Toss A Coin To Your W-… Security Guard. (Part 3)

In Part 3, I will improve the coin toss ability to add a visual throw arc to show how the coin will get to the destination, rather than just spontaneously appearing there.

Work-In-Progress. Improved more in the next post.

Today’s Objective: Improve the coin toss distraction ability by creating a throw arc from the player’s hand to the position the coin drops at.

The Code:

To calculate the arc starting at the hand (origin point) and ending at the floor (target point), 1 method involving a bit of maths is needed. But before that, I need some variables including a struct to hold the arc data.

Now for the calculation method:

Finally, to display the arc using a Line Renderer:

In my next post, I will be building on this to make it appear that the coin flies along this arc before landing.