Unity 2D Player Character Controller (Creating Animations From Sprites) . In This Tutorial We will Setup 2D character from scratch we will (1) Create Animations From Sprites. (2)Finite state machine setup. (3)study parameter in FSM. (4)scripting FSM changing Animations. (5)scripting basic character movements (run,jump etc.)
Thursday, 19 October 2017
Unity 2D Player Character Controller ( Finite state machine ) [02]
Unity 2D Player Character Controller (Creating Animations From Sprites) ...
Unity 2D Player Character Controller (Creating Animations From Sprites) . In This Tutorial We will Setup 2D character from scratch we will (1) Create Animations From Sprites. (2)Finite state machine setup. (3)study parameter in FSM. (4)scripting FSM changing Animations. (5)scripting basic character movements (run,jump etc.)
Wednesday, 18 October 2017
Unity Change Material,shader And Texture at Runtime (Hindi /Urdu)
#Unity #shader #color #material #albedo #3d #2d
Change Obeject material and color at runtime also you can change shader.
https://docs.unity3d.com/ScriptReference/Material-ctor.html
Monday, 16 October 2017
Unity 2D Infinite Background Scrolling [ Simple Way ]
Visit youTube channel for more Awesome videos..
https://www.youtube.com/channel/UCOGA5JnlIF7spbyEDAkFG-g
download code here..
http://urdutechtutorials.blogspot.com/2017/10/unity-2d-infinite-background-scrolling.html
Unity 2D Infinite Background Scrolling Simplest Way
Watch Video Tutorial
Code for Infinite Background Scrolling IN Unity 2d game.
Code for Infinite Background Scrolling IN Unity 2d game.
using UnityEngine; using System.Collections; public class Scroll : MonoBehaviour { public float backGroundSize; private Transform cameraTransform; public Transform[] layers; private float viewZone = 0; private int leftIndex; private int rightIndex; private void Start() { cameraTransform = Camera.main.transform; leftIndex = 0; rightIndex = layers.Length - 1; } void Update() { if (cameraTransform.position.x < (layers[leftIndex].transform.position.x + viewZone)) ScrollLeft(); if (cameraTransform.position.x > (layers[rightIndex].transform.position.x - viewZone)) ScrollRight(); } private void ScrollLeft() { layers[rightIndex].position = new Vector3 (1f * (layers[leftIndex].position.x - backGroundSize), 0f, 0f); leftIndex = rightIndex; rightIndex--; if (rightIndex < 0) rightIndex = layers.Length - 1; } private void ScrollRight() { layers[leftIndex].position = new Vector3 (1f * (layers[leftIndex].position.x + backGroundSize), 0f, 10f); rightIndex = leftIndex; leftIndex++; if (leftIndex == layers.Length) leftIndex = 0; } }
Sunday, 15 October 2017
The Best Way to jump in Unity3d
Attach these two scripts with your player and feel the difference in jumping it works both for 3D and 2D for 2D you have to make some adjustments in betterJump script.
WATCH VIDEO TUTORIAL
WATCH VIDEO TUTORIAL
Player Script:
using System.Collections; using System.Collections.Generic; using UnityEngine; public class Player : MonoBehaviour { public float speed = 10.0F; public float rotationSpeed = 100.0F; // Use this for initialization void Start () { } // Update is called once per frame void Update () { float translation = Input.GetAxis("Vertical") * speed; float rotation = Input.GetAxis("Horizontal") * rotationSpeed; translation *= Time.deltaTime; rotation *= Time.deltaTime; transform.Translate(0, 0, translation); transform.Rotate(0, rotation, 0); if (Input.GetKeyDown(KeyCode.Space)) { jump(); } } void jump() { transform.GetComponent<Rigidbody>().AddForce(new Vector3(0, 190 * Time.deltaTime, 0),ForceMode.Impulse); } }
Better Jump Script (for 3D project)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class fastJump : MonoBehaviour {
public float fallMultiplier = 2.5f;
public float lowJumpMultiplier = 2f;
Rigidbody rb;
void Awake()
{
rb = GetComponent<Rigidbody>();
}
void Update()
{
if (rb.velocity.y < 0)
{
rb.velocity += Vector3.up * Physics.gravity.y * (fallMultiplier - 1)
* Time.deltaTime; } } }
Better Jump Script (for 2D project)
using System.Collections; using System.Collections.Generic; using UnityEngine; public class fastJump : MonoBehaviour { public float fallMultiplier = 2.5f; public float lowJumpMultiplier = 2f; Rigidbody2D rb; void Awake() { rb = GetComponent<Rigidbody2D>(); } void Update() { if (rb.velocity.y < 0) { rb.velocity += Vector2.up * Physics2D.gravity.y * (fallMultiplier - 1) * Time.deltaTime; } } }
Labels:
2d,
3d,
best way to jump,
better jump,
Game development,
how to jump,
jump,
jump in unity,
unity,
unity 2d,
unity 5 tutorials,
Unity in Hindi,
Unity tutorials,
Unity Tutorials in Urdu
Subscribe to:
Posts (Atom)