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

From Executive Manager to Web Developer: What I have learned and how it can help you become a…

How to Upgrade to Ubuntu 22.04 LTS

What method should you use to create a date table in Power BI?

Hyperparameter Tuning on AI Platform using Cloud Composer

How to setup/install gnome-tweak-tool for Kali

Common gotcha with promises

Building Narrative CLI programs using an API — or how I stole Rick’s watch

Let’s get to know about Azure Active Directory — II

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

Are we alone?

How to be a BRIC Owner? #STEP3

ebric, buy a bric, how to install and create metamask wallet, infographic, illustration guide, fractional ownership, property investment

Samantha Giesige’s Botanical Paintings Luxuriate in the Psychological Effects of Color [Interview]

Samantha Giesige’s botanically inspired latex paintings luxuriate in the psychological effects of color, playing with temperature, harmony, and context just for the fun of it.

[Author]: DEEPAK DIKSHITH WRITINGS