Invisible Walls!

In my last post I covered how I got our little cube moving, and move it does. If you noticed in the GIF that was posted, our cube was leaving the bounds of the screen. We don’t want that so let’s fix that!

First and lastly, we want to restrict the cube from going out of bounds on the y-axis, so to do that we want to Clamp the cubes transform position between a minimum and maximum value.

Communicate with your player to get them comfortable!

Mathf Documentation: https://docs.unity3d.com/ScriptReference/Mathf.html

Mathf.Clamp Documentation: https://docs.unity3d.com/ScriptReference/Mathf.Clamp.html

--

--

--

If ambition and practicality amalgamated, it would be me! I am here to climb the mountains of my ambition and catalog my journey so that someone can be changed!

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

Recommended from Medium

Perfect Custom Mac Pro build for QA Engineering

Don’t misuse “is” operator in python

Trias Weekly Report (Dec 7, 2020 — Dec 13, 2020)

Low-Code Vendor Lock-In, Interfaces as a Universal Pattern, REST vs GraphQL Performance

Bug discovery diaries: uncovering sngrep overflow issues with blackbox fuzzing

OpenSIPIt, online event for testing SIP implementations

Be friend with your Terminal

Tower Watcher

Tower Watcher

Playing ESP32 is Easy and Fun! [Installation Process + Blink Mode]

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
Andrew Lengen

Andrew Lengen

If ambition and practicality amalgamated, it would be me! I am here to climb the mountains of my ambition and catalog my journey so that someone can be changed!

More from Medium

On Injustice and Purpose

Beginning of the end Chapter 25

Best Lullabies Songs to Help Any Crying Baby to Sleep

Overwriting the writing phobia by writing anyway