-
OnCollisionEnter
Can be used to detect collisions with other gameobjects, and behave based on an if statement.
-
My use of OnCollisionEnter in Unity
When a black sphere hits a block, the script deletes the block.
Can be used to detect collisions with other gameobjects, and behave based on an if statement.
When a black sphere hits a block, the script deletes the block.
A RayCast is an invisible Ray that detects colliders
Origin of a Ray is a point in the space
Origin is stored as a vector 3 with x, y, and z position.
Second Vector 3 to store direction.
You can use Ray Variable as it stores 2 vector 3’s
RayCastHit hitInfo stores info on colliders hit
you can also add floats like distance (to define length of the ray) and Layer mask for objects that you want the ray to ignore (if its put on a specific layer)
If statement for collision with environment tag
Works like parenting
Can be linked to a point in the world or a RigidBody
Break Force and Break Torque – Amount of force needed to break the joint.
GameObject is trying to reach a target position
Target position = position its set to in the scene view
Any RigidBodies attached will try to pull it from this position on an invisible spring attached to an anchor point
Anchor is the pivot point – shown as orange dot/box
Spring parameter = how strong the spring is
Higher value = tighter/stronger spring
Damper = how much the joint will slow down in motion
Higher the damper value = how much less the spring will overshoot
Min/Max distance is a dead zone
Spring also has break force and break torque
Ideal for Doors
Axis – hinge the object rotates around
Set anchor for its axis – still represented in orange
You can use spring settings under “Use Spring”
Motors apply force constantly, like a revolving door
Target velocity – speed its trying to rotate
Force – how easily the speed can be changed by collision
Free spin checkbox – will not decelerate
Limits contain your pivot
Min and Max are limits to the angles
Min/max bounce are how much it will bounce off of its limits
Also has Break Force and Torque
Trello: https://trello.com
Pro: Customizable board, organized tasks.
Con: Buttons and adding things are a bit confusing.
Taiga: https://taiga.io/
Pro: Buttons are obvious and easy.
Con: A bit unorganized, only 2 columns compared to Trello’s 4.
Asana: https://asana.com
Pro: Very professional and organized.
Con: Website errors are common.
The site I will be using is Taiga, as it seems the most simple and straight-forward of the bunch, which suits my needs. I don’t need a complicated program for a school project.
GetKeyDown(KeyCode.[Key on keyboard]) is how you make keys operate function in code with an if statement.
Drag and drop C# scripts to add to object.
“Add component” can create and add a C# script at the same time.
int = integer
int myInt = 5; means I want the integer 5.
Maintains value until assigned a new one.
Void doesn’t return values.
parameterName can put in parameters to what integer can appear.
Ret = return a number
Debug.log is console window
Syntax: structure of language
. Separates things that are sub of each other, think of country.city
; terminates, so use at end except for }
Indent to organize
//this is a normal one line comment
/* this is a
*two line comment
Java uses less lines, c# more specific
Default is different, c# is private, java is public
If chooses one or another depending on certain things that can happen
Else is what happens if it is false
While happens until parameter is false
Do while is at end while while in at start, so do while always happens once.
Do while has semicolon at end
for does certain loops for certain parameters in increments
For each loops through items of an array until there are no more items
Classes are where functions happen
Organize different functions into different classes for organization
Constructor gives default values for variables and it’s end syntax is ()
() is for parameters
Parameters are for new objects
https://unity3d.com/learn/tutorials/topics/scripting/simple-clock
Manual: https://docs.unity3d.com/Manual/GameObjects.html
This Gives an in depth explanation of GameObjects and how they work inside Unity.
Scripting: https://docs.unity3d.com/ScriptReference/GameObject.html
This showcases a lot of different functions for scripting and each link explains what each function does.
I learned how to code different objects into being able to rotate at different speeds and directions, as well as have them move to the actual time as shown with the clock.
Steve was not a smart boy. He didn’t know if he could feed his pet goldfish fruit, of it were allergic to fruit. Or was the fruit allergic to the fish? He just wanted to make sure he was keeping his little fish friend healthy.
He decided his final option was to take his fish, Michael Bubble, to the vet. The only problem was the glue industry had crashed, meaning no glue could be found anywhere anymore. most stores tried scotch tape, but this was not a proper substitute, as fliers everywhere flew through the streets. He decided to hold the fishbowl out in front of him, just in case he got hit or something, I dunno, Steve is dumb. But luck was not on Steve’s side, as a newspaper flew right into his face, resulting in him dropping the bowl, leaving glass and water everywhere.
Steve was devastated. His only friend was drowning in the air. He picked the fish up and sprinted to the vet. Without thinking, he burst through the vet doors and straight past the waiting room, exclaiming hat t was an emergency. He ran to the nearest doctor and asked for immediate help. The doctor took one look at Steve and asked if he was on drugs.
“Maybe…” Steve said. “Why?”
“Because this is plastic.” The doctor said.
Steve gasped, how could this doctor insult his fishy friend like this. Steve slapped the doctor and was tackled by security immediately. He struggled against the security guards to his fish on the ground, where the doctor had dropped it after being slapped. His drug induced strength made him able to wriggle free and grab the fish, but there was trouble. The Swat team had arrived.
He made a run for it out the window, and crashed through. He ran about five blocks before being tasered. The police dragged him into their vehicle and sped off towards the jail where Steve will be held until trial. Steve is now in jail for 15 years for Assault and Possession of Heroin. Steve and many others are the reason why the opioid crisis needs to be stopped.
(Screen Shot of the zone where new sounds play [red rectangle], and the sound mixers)
In unity, I learned how to play sounds in certain areas by writing a piece of code that activates a sound mixer when you step inside a certain area. This could be potentially used for zone music, or even cutscenes. I did have a problem with the code, because it wouldn’t let me manually add components into the game manager section, but now I have it mostly working, I just need to figure out how to establish that the red rectangle is the zone.
Project Name | Scale |
Project Description | A simple platformer, where a character can shrink and grow objects to help them get up a mountain. |
Project Sponsor | INFO GOES HERE… |
Project Team Member(s) | INFO GOES HERE… |
Project Objectives | I want to learn more about the game design prosecc by developing this game, and maybe even fully completing it. |
Project Milestones | Have all sprites done,
All levels designed, Have an organized process going, Have organized code, Have five or six songs for the game done. |
Assumptions | I would assume that since this is my first game that we will run into many problems, and may not finish. |
Project Completion Date | INFO GOES HERE… |