Video-3
[Link](“….”); -> prints to console
Public Rigidbody rb;
[Link]=false;
[Link](x,y,z); (called once when we start the game)
In update, it will happen for the rest of the game -> rate of updation depends on frame rate (faster
computer will run faster than a slower computer)
Soln: [Link](x,y,z*[Link]); (inv proportional to frame rate)
FixedUpdate instead of Update for physics related things
Video-4
Rigidbody -> constraints-> freeze position/rotation
But the above method wont be good in case the object collides with another object
Soln: physics object needed (controlling friction)
Create->physic(s) material-> set static and dynamic friction to zero and drag it to ground
Use of variables:
Int (whole no), float, string, bool (500f for floats is advised)
To edit variable in inspector: public <type> <data> (inspector is on left side of unity window)
Player input -> if statement
if ([Link](“d”))-> checks if user pressed ‘d’ on keyboard
put appropriate addforce commands to have exhibit necessary changes whenever use performs
certain actions
Video-5: Following Player Movements By The Camera (Multiple ways)
1. Parenting camera: Dragging camera under player
But camera rotates when player rotates as well (looks weird)
soln:
2. Follow position of the player:
Newscript created (FollowPlayer) (camera)
Transform-> data type (link to player’s position, rotation,etc.)
Then public Transform player; drag player onto the inspection at main camera
In update: [Link]([Link]) -> gives current x,y,z coordinates of the player
transform-> refers to current object (object the script is sitting on)
[Link]-> position of our camera
[Link] = [Link]; -> but it follows centre of the player
desirable: (maybe) a bit behind and a bit above
soln: offset: y=1, z=-5
Vector3-> data type (stores 3 floats)
public Vector3 offset;
[Link] = [Link]+offset;
Video-6: Collisions
New script: PlayerCollision
void OnCollisionEnter(Collision collisionInfo)-> called whenever the object (here,player) collides with
some object
that object can be dragged into Player Collision script as long as it is rigid body and has box collider
create-> material -> drag onto newly created obstacle
rigidbody: add component-> physics-> rigidbody
maybe increase mass(2)
[Link]([Link]);
One utility:
if([Link] == "Obstacle")
[Link]("We hit an obstacle!");
Using tags to refer instead of names: inspector-> add tag
if([Link] == "Obstacle")
[Link]("We hit an obstacle!");
To avoid the player from flying away after hitting an obstacle:
public PlayerMovement movement;
if([Link] == "Obstacle")
[Link] = false; //disables Player Movement if an obstacle is hit
Video 7: Making a Video Game
Create prefab of obstacle: drag obstacle object to the project panel (to use multiple objects of same
type)
Changes-> click apply to apply to all obstacles
Problem: slow controls due to problem with movement script
(momentum builds up over time)
[Link] and less sideway force (approx. 100 would do)
Increase drag
And so amp up forces
window > Rendering > Lighting > Environment for fog(so that next obstacles are not visible)
Video 8: Coins/Points in Game
For those who don't have their starting position at Z 0, I made something to make it easier:
1. Add a public float variable called "initialZ"
2. Add a void Start() method (if you removed it)
3. Inside it, add "initialZ = [Link].z" (replace "player" with what you named your player)
4. On the top of the Update() method, add the following: "float newZ = [Link].z - initialZ;"
5. Replace "[Link]()" (where you change your text) with "[Link]()"
or anyone following this tutorial in 2021 or until they change it, you can add text from
GameObject(at the top) -> UI -> Text
If you are using Text Mesh Pro, then disable "Wrapping" instead of enabling "Overflow"
If you have new version unity then lighting is set after GAME OVER is by these steps 1) click on
Window 2) click on Rendering 3) click on Lighting 4) Then click on Generate Lighting which is present
in Light Probe Visualization 5) Done. I hope this helps
Ensure that your sampling rate is at least 10 times the carrier frequency. Since your carrier is 200 kHz,
a sampling rate of 2 MHz or higher is recommended. This will help in accurately capturing the high-
frequency variations of the FM signal for a smooth derivative.