I made a thing! Take it!

It’s not every day I share my secrets and hard work with the world without some sort of tutorial containing images (So viewers need to type the code themselves), but as an extra task at my University (SAE QANTM, Brisbane) programmers were asked to make a useful tool/script for Unity. This tool would be one that could be used multiple times in different scenarios and would save themselves and others a lot of time writing something similar every time they needed it.

This tool would then be added to a ‘GCL’ (Game Code Library) created by Steve Halliwell on GitHub for all to use and share. You can find the public git here.

My choice of tool was something that I was already working on and I decided could be extremely useful to share, and that was an Item Pickup/Throwing script. (Standard version & Controller+Vibration version included HERE)
3
The script allows players to pick up whatever is in front of them with the tag “PhysicsObject”. When an object is grabbed it becomes transparent and floats in front of the player at a designated position. The object can build up power over time and be thrown at high speeds, or even placed down gently.

Setup for this script is simple and only requires some form of player with a player controller, a first person camera and a pickup point placed in front of the camera. The camera and pickup point need to be assigned in the inspector, and the object selected gets assigned when picking an object up automatically. MinForce and MaxForce are both manually set based on user preference as well as Addition Factor (Not shown in this image but controls the rate of force increase per second).

There are four functions that need to be called upon inputs selected by the individual developer (you), these are shown in the next set of images and require no arguments to be passed alongside them.
45As seen these functions are ‘SelectObjectInFront()’, ‘DeselectObjectInFront()’, ‘IncreasePower()’, and ‘Fire()’. The git includes a README detailing how exactly to use these and my recommendations.

The controller & vibration edition includes changes made by Tylah Kapa and requires the plugin XInputDotNet  and can be found HERE.

This tool is provided free of charge for both private and commercial use, credit is not required upon use but is appreciated. Licensed under the ‘Unlicensed’  License found HERE.

While I may possibly write another blog detailing exactly how the tool works in the future I am ending this one here, ENJOY!

Leave a comment