gpfvadbvba abvdasbv vabdvaadfadf avd.pdf

ashwinidigimarketerz 0 views 58 slides Sep 26, 2025
Slide 1
Slide 1 of 58
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48
Slide 49
49
Slide 50
50
Slide 51
51
Slide 52
52
Slide 53
53
Slide 54
54
Slide 55
55
Slide 56
56
Slide 57
57
Slide 58
58

About This Presentation

vasdg ergwerg g ewgwerg ergqergq


Slide Content

Practical no:01

AIM : Set up Direct X 11,Window Frame work and Initialize Direct3D Device.
Theory:
DirectX is an application program interface (API) for creating and managing graphic
images and multimedia effects in applications such as games or active Web pages
that will run in Microsoft's Windows operating systems.

Open visual studio : File -> New -> Project -> Visualc# -> Select Windows Forms Application
Framework : .Net Framework3.0 .

Add References :
Right Click on References -> Add References -> Browse -> Click on Browse Button Go
to C -> Windows -> Microsoft.Net folder ->DirectX for managed code ->folder 1.0.2902.0
Select the all the files ->click on OK

Now right click on your Form1.cs design and click on View code.and modify the code as given
below.

using System;
using System.Windows.Forms;
using Microsoft.DirectX;
using Microsoft.DirectX.Direct3D;

namespace WindowsFormsApp2
{
public partial class Form1 : Form
{
Microsoft.DirectX.Direct3D.Device device;

public Form1()
{
InitializeComponent();
this.Load += new EventHandler(Form1_Load);
this.Paint += new PaintEventHandler(Form1_Paint);
}

Now, as we are dealing with 3D files we have to change the capacity of our CPU from x64 to
x86.for that follow below steps.
Click on Any CPU -> Configuration manager ->New-> select x86 as a new platform ->click on
Ok-> click on close.

private void Form1_Load(object sender, EventArgs e)
{
InitDevice();
}

public void InitDevice()
{
PresentParameters pp = new PresentParameters();
pp.Windowed = true;
pp.SwapEffect = SwapEffect.Discard;

device = new Device(0, DeviceType.Hardware, this,
CreateFlags.SoftwareVertexProcessing, pp);
}

private void Render()
{
if (device == null)
return;

device.Clear(ClearFlags.Target, System.Drawing.Color.Pink, 1.0f, 0);
device.BeginScene();
// Draw any 3D objects here if needed
device.EndScene();
device.Present();
}

private void Form1_Paint(object sender, PaintEventArgs e)
{
Render();
}
}
}

Now start debugging your project it will successfully change the background color of form using
the paint method.

Practical 2
Aim: Learn Basic Game Designing Techniques with pygame.
2A]Create a gaming window using pygame.
Theory:
● Pygame is a cross-platform set of Python modules which is used to create video
● games.
● It consists of computer graphics and sound libraries designed to be used with the
Python programming language.
● Pygame was officially written by Pete Shinners to replace PySDL.
● Pygame is suitable to create client-side applications that can be potentially wrapped in
a standalone executable.

import pygame
import sys
pygame.init()
# Set up window
screen = pygame.display.set_mode((800, 600))
pygame.display.set_caption("Game Window")
# Game loop
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()

screen.fill((30, 30, 30)) # Dark background
pygame.display.flip()

2B] Write a python program to draw different shapes using pygame Pygame Draw.
• Pygame provides geometry functions to draw simple shapes to the surface.
• These functions will work for rendering to any format to surfaces.
• Most of the functions accept a width argument to signify the size of the
thickness around the edge of the shape.
• If the width is passed 0, then the shape will be solid(filled).
• All the drawing function takes the color argument that can be one of the
following formats:
o A pygame.Color objects
o An (RGB) triplet(tuple/list)
o An (RGBA) quadruplet(tuple/list)
o An integer value that has been mapped to the surface's pixel format
● Draw a rectangle
The following functions are used to draw a rectangle on the given surface.
1. pygame.draw.rect(surface, color, rect)
2. pygame.draw.rect(surface, color, rect, width=0)
Parameters:
o surface - Screen to draw on.
o color- This argument is used to color the given shape. The alpha value is
optional if we are using a tuple.

o rect(Rect)- Draw rectangle, position, and dimensions.
o width(int)- This is optional to use the line thickness or to indicate that the
rectangle is filled.

● Draw a straight line
This method is used to draw a straight line on the given surface. There are no
endcaps.
1. pygame.draw.line(surface,color,start_pos,end_pos,width)
2. pygame.draw.line(surface,color,start_pos,end_pos,width=1)
Parameters:
o surface - Screen to draw on.
o color- This argument is used to color the given shape. The alpha value is
optional if we are using a tuple.
o start_pos- start position of the line(x,y)
o end_pos- End position of the line
● Draw a Circle
Below are the functions, which are used to draw a circle on the given surface.
o circle(surface, color, center, radius)
o circle(surface, color, center, radius, width=0)
Parameters:
o surface - Screen to draw on.
o color- This argument is used to color the given shape. The alpha value is optional if we are
using a tuple.
o center - The center point of the circle as a sequence of two int/float, e.g.(x,y)
o radius(int or float)- radius of the circle, measured from the center parameter, if the radius is
zero, then it will only draw the center pixel.
.
import pygame
import sys
pygame.init()
screen = pygame.display.set_mode((600, 400))
pygame.display.set_caption("Drawing Shapes")
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
screen.fill((255, 255, 255))
pygame.draw.rect(screen, (0, 128, 255), (150, 100, 100, 50))
pygame.draw.circle(screen, (255, 0, 0), (300, 200), 40)

2C]Write a python code to apply/change position of an object using key events with pygame.
pygame.draw.line(screen, (0, 255, 0), (0, 0), (600, 400), 5)
pygame.display.flip()
import pygame
import sys
pygame.init()
screen = pygame.display.set_mode((600, 400))
clock = pygame.time.Clock()
player_pos = [300, 200]
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
keys = pygame.key.get_pressed()
if keys[pygame.K_LEFT]: player_pos[0] -= 5
if keys[pygame.K_RIGHT]: player_pos[0] += 5
if keys[pygame.K_UP]: player_pos[1] -= 5

2D] Write a python program for Collision Detection.
Pygame Sprite and Collision detection
● A pygame sprite is a two-dimensional image that is part of the large graphical
scene. Usually, a sprite will be some object in the scene.
● One of the most advantages of working with sprites is the ability to work with
them in groups. We can easily move and draw all the sprites with the one
command if they are in the group.
● The Sprite module contains the various simple classes to be used within the
games. It is optional to use Sprite classes and different group classes when using
pygame.
● Pygame provides sprites and sprite groups that help for collision detection.
● Collision detection is the process when two objects on the screen collide each
other. For example, if a player is hit by the enemy's bullet, then it may lose a life
or, the program need to know when the player touches a coin so that they
automatically picked up.
if keys[pygame.K_DOWN]: player_pos[1] += 5
screen.fill((0, 0, 0))
pygame.draw.rect(screen, (0, 255, 0), (*player_pos, 40, 40))
pygame.display.flip()
clock.tick(60)

import pygame
import sys
pygame.init()
screen = pygame.display.set_mode((600, 400))
player = pygame.Rect(100, 100, 50, 50)
enemy = pygame.Rect(300, 100, 50, 50)
clock = pygame.time.Clock()
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
keys = pygame.key.get_pressed()
if keys[pygame.K_RIGHT]: player.x += 5
if keys[pygame.K_LEFT]: player.x -= 5
screen.fill((255, 255, 255))
pygame.draw.rect(screen, (0, 255, 0), player)
pygame.draw.rect(screen, (255, 0, 0), enemy)
if player.colliderect(enemy):
print("Collision detected!")
pygame.display.flip()
clock.tick(60)

2E] Write a python program to design a score system with pygame..
❖ Pygame Surface
• The pygame Surface is used to display any image.
• The Surface has a pre-defined resolution and pixel format.
• The Surface color is by default black.
• Its size is defined by passing the size argument.
• Surfaces can have the number of extra attributes like alpha planes, color keys, source
rectangle clipping, etc.
• The blit routines will attempt to use hardware acceleration when possible; otherwise,
they will use highly enhanced software blitting methods.
❖ Pygame Clock
• Times are represented in millisecond (1/1000 seconds) in pygame.
• Pygame clock is used to track the time.
• The time is essential to create motion, play a sound, or, react to any event.
• In general, we don't count time in seconds. We count it in milliseconds.
• The clock also provides various functions to help in controlling the game'sframe rate.
The few functions are the following:
❖ tick()
This function is used to update the clock. The syntax is the following:
❖ tick(framerate=0)
• This method should be called once per frame.
• It will calculate how many milliseconds have passed since the previous
call.
• The framerate argument is optional to pass in the function, and if it is
passed as an argument then the function will delay to keep the game
running slower than the given ticks per second.
❖ tick_busy_loop()
• The tick_busy_loop() is same as the tick().
• By calling the Clock.tick_busy_loop(20) once per frame, the program
will never run at more than 20 frames per second.
• The syntax is the following:
tick_busy_loop()
❖ get_time()
• The get_time() is used to get the previous tick.
• The number of a millisecond that isdra passed between the last two calls
in Clock.tick().
get_time()

❖ Pygame Blit
• The pygame blit is the process to render the game object onto the surface,and this process
is called blitting.
• When we create the game object, we need to render it.
• If we don't render the game objects and run the program, then it will give the black
window as an output.
• Blitting is one of the slowest operations in any game so, we need to be careful to not to
blit much onto the screen in every frame.
• The primary function used in blitting is blit(), which is:
blit()
blit(source,dest,area=None,special_flags=0)

import pygame
import sys
pygame.init()
screen = pygame.display.set_mode((600, 400))
font = pygame.font.SysFont(None, 48)
score = 0
clock = pygame.time.Clock()
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
screen.fill((0, 0, 0))
score += 1
score_text = font.render(f"Score: {score}", True, (255, 255, 255))
screen.blit(score_text, (20, 20))
pygame.display.flip()
clock.tick(60)

Practical no. 3
AIM : Develop a snake game using pygame.
● User-defined functions in Python.
● Python pygame.Color() function
● Python pygame.time.Clock() function
● Python random.randrange(start, stop, step) method
● Python pygame.display.set_caption() method
● Python pygame.display.set_mode() function
● Pygame pygame.render() method
● Pygame .get_rect() function
● flip() method in Pygame
● Pygame .blit() method
● time.sleep() in Python
● pygame.quit() in Pygame.
● pygame .midtop() function
● for loop in Python
● if statements in Python.
● if- else loop in Python
● .insert() in Pygame
● .fill() in Pygame

Theory:
❖ Pygame Text and Font
• Pygame also provides facilities to render the font and text.
• We can load fonts from the system by using the pygame.font.SysFont() function.
• Pygame comes with the built-in default font which can be accessed by passing the font
name or None.
• There are many functions to help to work with the font.
• The font objects are created with pygame.font.Font().
• The actual font objects do most of the works done with fonts.
• Font objects are generally used to render the text into new Surface objects.
• Few important font functions are the following:
❖ render()
• This function is used to draw text on a new Surface.
• Pygame has no facility to draw text on the existing Surface.
• This creates a new Surface with the specified text render on it.
• The syntax is the following:
render(text, antialias, color, background=None)

❖ size()
• This function is used to determine the number of space or positioning
needed to render text.
• It can also be used for word-wrapping and other layout effects.
• The syntax is the following:
size(bool)

❖ set_bold()
● This function is used for bold rending of text. The syntax is following:
● set_bold(bool)
❖ Pygame Keydown
Pygame KEYDOWN and KEYUP detect the event if a key is physically pressed and
released. KEYDOWN detects the key press and, KEYUP detects the key release. Both
events (Key press and Key release) have two attributes which are the following:
● key: Key is an integer id which represents every key on the keyword.
● mod: This is a bitmask of all the modifier keys that were in the pressed state when
the event occurred.
Code:
import pygame, time, random
pygame.init()
w, h = 720, 480
win = pygame.display.set_mode((w, h))
pygame.display.set_caption("Snake Game")
clock = pygame.time.Clock()
# Colors
white = (255,255,255)
green = (0,255,0)
red = (255,0,0)
black = (0,0,0)
snake = [[100, 50], [90, 50], [80, 50]]
fruit = [random.randrange(1, w//10)*10, random.randrange(1, h//10)*10]
direction = 'RIGHT'
score = 0
font = pygame.font.SysFont('times new roman', 20)
def game_over():
msg = pygame.font.SysFont('times new roman', 50).render(f'Game Over! Score: {score}',
True, red)
win.blit(msg, msg.get_rect(center=(w//2, h//3)))
pygame.display.flip()
time.sleep(2)

pygame.quit()
quit()
while True:
for e in pygame.event.get():
if e.type == pygame.QUIT:
game_over()
if e.type == pygame.KEYDOWN:
if e.key == pygame.K_UP and direction != 'DOWN': direction = 'UP'
elif e.key == pygame.K_DOWN and direction != 'UP': direction = 'DOWN'
elif e.key == pygame.K_LEFT and direction != 'RIGHT': direction = 'LEFT'
elif e.key == pygame.K_RIGHT and direction != 'LEFT': direction = 'RIGHT'
head = snake[0][:]
if direction == 'UP': head[1] -= 10
elif direction == 'DOWN': head[1] += 10
elif direction == 'LEFT': head[0] -= 10
elif direction == 'RIGHT': head[0] += 10
snake.insert(0, head)
if head == fruit:
score += 10
fruit = [random.randrange(1, w//10)*10, random.randrange(1, h//10)*10]
else:
snake.pop()
if (head[0] < 0 or head[0] >= w or head[1] < 0 or head[1] >= h or head in snake[1:]):
game_over()
win.fill(black)
for s in snake:
pygame.draw.rect(win, green, (*s, 10, 10))
pygame.draw.rect(win, white, (*fruit, 10, 10))
win.blit(font.render(f'Score: {score}', True, white), (10, 10))
pygame.display.update()
clock.tick(10)

Practical no : 04
Aim: Create a 2D target shooting game using pygame.
Theory:
Game Overview
● The player controls a paddle at the bottom of the screen.

● The player can shoot bullets upward by clicking the mouse.

● Targets (red ellipses) move horizontally near the top of the screen.

● The goal is to shoot as many targets as possible within 60 seconds.

● The game ends when the timer reaches zero, displaying the final score.

Code:
import pygame, random, sys
pygame.init()
w, h = 800, 600
win = pygame.display.set_mode((w, h))
pygame.display.set_caption("Minimal Target Shooting")
clock = pygame.time.Clock()
font = pygame.font.SysFont(None, 36)
big_font = pygame.font.SysFont(None, 60)
player = pygame.Rect(w//2 - 30, h - 20, 60, 20)
bullets, targets = [], []
score, time_limit = 00, 60
start = pygame.time.get_ticks()
class Bullet:
def init (self, x, y): self.r = pygame.Rect(x-5, y-20, 10, 20)
def move(self): self.r.y -= 10
class Target:
def init (self):
self.r = pygame.Rect(random.randint(0, w-40), 20, 40, 40)
self.s = random.choice([-3, -2, 2, 3])
def move(self):
self.r.x += self.s
if not (0 <= self.r.x <= w - self.r.w): self.s *= -1
running = True
while running:
win.fill((30, 30, 30))

secs = time_limit - (pygame.time.get_ticks() - start)//1000
if secs <= 0: break
for e in pygame.event.get():
if e.type == pygame.QUIT: pygame.quit(); sys.exit()
player.centerx = pygame.mouse.get_pos()[0]
if pygame.mouse.get_pressed()[0] and len(bullets) < 5:
bullets.append(Bullet(player.centerx, player.top))
for b in bullets[:]:
b.move()
pygame.draw.rect(win, (255, 255, 0), b.r)
if b.r.bottom < 0: bullets.remove(b)
if random.randint(1, 40) == 1: targets.append(Target())
for t in targets[:]:
t.move()
pygame.draw.ellipse(win, (200, 0, 0), t.r)
for t in targets[:]:
for b in bullets[:]:
if t.r.colliderect(b.r):
targets.remove(t)
bullets.remove(b)
score += 1
break
pygame.draw.rect(win, (0, 200, 255), player)
win.blit(font.render(f"Score: {score}", True, (255, 255, 255)), (10, 10))
win.blit(font.render(f"Time: {secs}s", True, (255, 255, 255)), (w - 150, 10))
pygame.display.update()
clock.tick(60)
# Game Over
win.fill((50, 100, 150))
win.blit(big_font.render("GAME OVER", True, (255, 0, 0)), (w//2 - 150, h//2 - 30))
win.blit(font.render(f"Your Score: {score}", True, (255, 255, 255)), (w//2 - 100, h//2 + 20))
pygame.display.update()
pygame.time.delay(4000)
pygame.quit()

Practical no: 05
Aim: Creating 2D Infinite Scrolling Background in Unity.
Parallax Effect: With creating multiple scrolling backgrounds with transparency you can create a
parallax effect.
Just set the scrolling speed of closer objects fast and the scrolling speed of far objects slow. Make
sure to set the order layer accordingly in the Inspector. This will add some depth to your game
making it look a lot better.
Here are the steps to create a scrolling background in Unity.
Step 1: create a 2D project in Unity and name it.


















STEP 2: Select the image and add it in the asset or scene folder, you will get it on the left side
corner.
Go to asset —> click on import new asset →add the image file (png,jpeg).

STEP : 2 Click on image which is added in the asset interface .
Go to inspector window (i.e properties of the image )
Select the texture type as “ texture “ if texture is not there you can use the texture type as

“default”.


STEP : 3 After Selecting the texture type, change the “Wrap type” as “repeat”
STEP : 4 Once the texture type and Wrap type is changed you have to Click on “Apply”.
Otherwise the changes will not be inco-operated in the scene.

STEP 5: Now to set the frame for background you have to
Click on Gameobject → 3D object →QUAD → Rename it as "Background"
Create a Quad which will decide the size of the background.

STEP 6 : Increase the size of Quad. you will get from inspector window (properties ) of quad
Scale it to x = 20 and y = 10

STEP 7: If the background seems to be darker then you can use light, which will help to see the
background image properly with bright color.
For that Click on GameObject → light —> directional light.
then drag and drop the background(image that you have added in the asset window).
STEP 9 : Adjust the intensity of light to see the bright color.It will be available in the inspector
window
(properties).

STEP 10: Now we have to write the script to scroll the background.
so we have to create asset as script.
click on “Background” (herierachy window ) —> go to Insception Window —> at the end
you will get “ADD COMPONENT” → click on it —> script → new script —> name it —>
Click on “create and add”

STEP 11 : Click on “script” which is added in the Asset window.
By Clicking on it Visual Studio will open write the code for scroller.
Next Save the file

Component added in the script:
A Vector2 is typically used to represent a point in 2D space in a Unity game. You can define a
Vector2 with two dimensions: Vector2 direction = new Vector2 ( 0.0f , 2.0f );
A renderer is what makes an object appear on the screen. Use this class to access the renderer of
any object, mesh or Particle System. Renderers can be disabled to make objects invisible (see
enabled), and the materials can be accessed and modified through them.
An offset Sets the depth bias on the GPU. Depth bias, also called depth offset, is a setting on the
GPU that determines the depth at which it draws geometry. Adjust the depth bias to force the
GPU to draw geometry on top of other geometry that is at the same depth.
Time simply gives you a numeric value which is equal to the number of seconds which have
elapsed since the project started playing. The value is a 'float', which means that you get exact
time including the fraction of the second which is currently elapsing, rather than discrete
whole-number seconds.
Main texture offset
The offset of the main texture. By default, Unity considers a texture with the property name
"_MainTex" to be the main texture. Use the [MainTexture] ShaderLab Properties attribute to
make Unity consider a texture with a different property name to be the main texture. This is the
same as calling Material.

GetComponent returns only the first matching component found on the GameObject on which it
is called, and the order that the components are checked is not defined. Therefore, if there are
more than one of the specified type that could match, and you need to find a specific one, you
should use Component.

STEP 12 : Once it's done, GO to unity → click on play symbol and play the game.
If there is no error in the code it will be added directly with the scene and the background will
start scrolling.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Scroll : MonoBehaviour
{
public float speed = 0.5f;

void Update()
{
// Create the offset based on time and speed
Vector2 offset = new Vector2(Time.time * speed, 0);

// Get the Renderer component and apply the texture offset
GetComponent<Renderer>().material.mainTextureOffset = offset;
}
}

Practical no :06
Aim : Create Camera Shake Effect in Unity.
Step 1: Create a New Unity Project (if needed)
1. Open Unity Hub.
2. Click New Project → Choose 2D or 3D Template.
3. Name it and click Create Project.


Step 2: Setup the Scene
1. Create a simple scene:

○ Add a Main Camera.
○ Add a simple object like a Cube or Sphere to visualize shake.

○ Add a new empty GameObject called CameraController and drag the
Main Camera into it to allow local position changes.

Step 3: Create Camera Shake Script
1. In the Project panel, right-click in the Assets folder.

2. Choose Create > C# Script.

3. Name it CameraShake.

4. Double-click to open it in Visual Studio or your code editor.

5. Replace the code with this:

using System.Collections;
using UnityEngine;

public class CameraShake : MonoBehaviour
{
public static CameraShake Instance;

private void Awake()
{
Instance = this;
}

public IEnumerator Shake(float duration, float magnitude)
{
Vector3 originalPos = transform.localPosition;
float elapsed = 0f;

while (elapsed < duration)
{
float x = Random.Range(-1f, 1f) * magnitude;
float y = Random.Range(-1f, 1f) * magnitude;
transform.localPosition = originalPos + new Vector3(x, y, 0f);
elapsed += Time.deltaTime;
yield return null;
}

transform.localPosition = originalPos;

Step 4: Attach the Script
1. Select the CameraController GameObject in the Hierarchy.

2. Drag the CameraShake script onto it to attach.

Step 5: Create Trigger Script to Test Shake

1. Create another C# script called ShakeTrigger.

2. Replace the contents with:

}
}
using UnityEngine;

public class ShakeTrigger : MonoBehaviour
{
void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
StartCoroutine(CameraShake.Instance.Shake(1f, 1f));
}
}
}

Step 6: Run and Test
Click Play in Unity.

Press Spacebar to trigger camera shake.You can see changes changes in the axes values in the
inspector window to CameraController.

Practical no: 07
Aim:Design and Animate Game Character in Unity.

STEP 1: Create a New Unity Project
1. Open Unity Hub.
2. Click New Project → Select 3D Core.
3. Name it and Click Create.


STEP 2: Download a Character from Mixamo
1. Go to https://www.mixamo.com and sign in (Adobe account is free).

2. In the Characters tab, choose any character (e.g. YBot or XBot).

3. Click Download:

○ Format: .fbx
○ Skin: With Skin
○ Frames per second: 30
4. Save it to a folder on your PC.

STEP 3: Download Animations from Mixamo
1. In Mixamo, go to Animations tab.
2. Search and download the following animations:
○ Idle
○ Walking
○ Running
○ Jumping
3. For each animation:
○ Download Without Skin
○ Format: .fbx
○ FPS: 30
○ Use “in place” motion when available

STEP 4: Import Files into Unity
1. Go to Unity.
2. Drag the downloaded character .fbx file into the Assets folder.
3. Drag the animation .fbx files into the same Assets folder.

STEP 5: Set Up Humanoid Rig

For each .fbx file:
1. Click on the file in the Project window.
2. In the Inspector panel:
○ Go to Rig tab.
○ Set Animation Type to Humanoid.
○ Click Apply.

Repeat this for all character and animation files.

STEP 6: Create an Animator Controller

1. Right-click in Assets → Create > Animator Controller

2. Name it: PlayerAnimator

3. Select your Character GameObject in the Hierarchy.

4. In the Inspector, assign the PlayerAnimator to the Animator component.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerController : MonoBehaviour
{

STEP 8: Configure Animation Transitions (Optional but Recommended)
1. In the Animator window, click on a transition arrow (e.g., Idle → Walk).

2. In the Inspector, configure conditions using parameters:

○ Click + under Conditions.
○ Set parameters like Speed, isJumping, etc., depending on your gameplay
logic.

3. Go to the Parameters tab (top left of Animator window):
○ Add Float, Bool, or Trigger parameters (e.g., Speed, isAttacking).

STEP 9: Add CharacterController to the Character
1. Select your Character GameObject in the Hierarchy (usually the root object that
contains the mesh and Animator).
public float moveSpeed = 5f;
public Animator animator;
private CharacterController controller;

void Start()
{
controller = GetComponent<CharacterController>();
}

void Update()
{
float move = Input.GetAxis("Vertical");
Vector3 moveDir = transform.forward * move * moveSpeed;

controller.Move(moveDir * Time.deltaTime);
// Set the "Speed" parameter to control blend tree
animator.SetFloat("Speed", Mathf.Abs(move));
}
}

2. In the Inspector panel, click Add Component.

3. Search for and select CharacterController.

4. Unity will automatically add a capsule-shaped collider to fit your character — adjust its
Center, Height, Radius to match your character’s body shape.


STEP 10: Test Your Character
● Press Play in Unity.

STEP-BY-STEP: Create Snowfall Particle Effect in Unity


◻ STEP 1: Create Particle System

1. Right-click in Hierarchy → Effects > Particle System.

2. Rename it to Snowfall.




◻ STEP 2: Position the Particle System
● Move it above your scene (e.g., Y = 20), so snow falls from the sky.

● If your scene is large, consider making the particle system loop and cover a wide area.




◻ STEP 3: Configure the Particle System
With the Snowfall GameObject selected, configure these in the Inspector:

Main Module

● Duration: 5 (or any number)

● Looping: ✅ On

● Start Lifetime: 8–12

● Start Speed: -1 to -3 (negative to fall downward)

● Start Size: 0.1 to 0.3

● Start Color: White or light gray

● Max Particles: 500–2000 (depending on performance)


Emission

● Rate over Time: 300–1000 (adjust based on snowfall density)


Shape

● Shape: Box

● Scale: X = 50, Y = 1, Z = 50 (or larger to cover scene)

● Position: Centered above the play area




◻ STEP 4: Add Snow Material (Optional)
1. Create a new Material (Assets → Right-click → Create > Material).

2. Set Shader to Particles/Standard Unlit.

3. Set Rendering Mode to Fade or Transparent.

4. Choose a white circle or snowflake texture (can be imported or use a white circle).

5. Assign this material to the Renderer > Material slot of the particle system.




◻ STEP 5: Fine-tune (Optional Enhancements)
Size over Lifetime

● Enable it → Curve: Use a small hump (start small → grow → shrink slightly)


Velocity over Lifetime

● Set a slight X or Z variation to simulate wind (e.g., X = 0.2)


Noise Module

● Enable Noise

● Strength: 0.1–0.5 on X, Y, Z (adds subtle drift)

● Frequency: 0.2 – 1




◻ STEP 6: Test and Optimize
● Press Play and view snowfall.

● Adjust parameters for density, fall speed, and area size.

● Use LOD or Particle Culling for better performance if needed.




✅ Bonus: Add a Snowflake Texture

If you want realistic flakes:

● Find a snowflake PNG (white on transparent).

● Import into Unity.

● Set Texture Type: Sprite (2D and UI) or Default.

● Drag it onto your snow material or use it directly in the Particle System Texture Sheet
Animation > Sprite module.