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.

For anyone wondering, the “pointNumber — 8” is a quick-fix, because the VFX wasn’t reaching the target point at the same time the real coin spawned, and I haven’t found a better fix yet.

The Result:

The “Real” Method
The “Fake” Method

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.

--

--

--

Unity game developer / C# Programmer / Gamer. Australian (Tasmanian) indie games developer for 10+ years. Currently looking for games industry employment.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

NEW FEATURES IN MDM CE 11.0 THROUGH 11.6

PentesterLab Bootcamp: PHP Include — Local/Remote File Inclusion

OnCollider(…) and OnTrigger(…): When to use them?

अर्थ Program Task — 18

Designing KPIs for APIs and Digital Programs: A Comprehensive Guide

Guide to Application Digital Transformation in Cloud & On-Premise — Part 3 (Technical Solution)

HADANFT - WTF

Guidance for Building a Control Plane for Envoy Part 4: Build for Extensibility

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Vincent Taylor

Vincent Taylor

Unity game developer / C# Programmer / Gamer. Australian (Tasmanian) indie games developer for 10+ years. Currently looking for games industry employment.

More from Medium

Making Elevators In A Unity Platformer

Unity For Beginners

How to Build and Test your Unity Game

How to Create A Loading Scene in Unity