Toss A Coin To Your W-… Security Guard. (Part 5)
In this post, I will be exploring the “Fake” method mentioned in my last post: Using Unity VFX to mimic a tossed coin flying.
Today’s Objective: Create the alternative “Fake” coin arc using the coin toss mechanic from my previous posts.
As mentioned in my previous post, I call this the “Fake” method because I am using a Trail Renderer to simulate a real coin flying, rather than an actual coin, like used in the “Real” method. Each method has it’s own pros and cons, so I tried out both.
The Code:
Building on the “PlayerControl” class from Part 4, I need some more variables:
Now, in the “TossCoin” coroutine, I add functionality for either the “Real” or “Fake” method. After the toss arc is calculated:
The “SpawnCoin” method does what the name implies. This should NOT be confused with the “SpawnAndTossCoin” method.
The “StartCoinVFX” coroutine is pretty simple, and similar to the initial arc calculation. It just uses a different arc resolution, because more = more smooth.
The Result:
Either version looks good, I think. It’s up to you to choose which would work best for your projects. Personally, I think I might keep the “Fake” one for now. Fortunately, switching is as simple as 1 click.