Menu Close

Add Force To An Object In Unity – Unity Tutorial 7

0 0
Read Time:29 Second

Table of Contents

Title

How To Add Force To An Object In Unity | Learn Unity | Game Development Tutorial 7 Urdu/Hindi

Content

  • Add 3D GameObject
  • Change Material Of GameObject
  • Add Rigibody Component
  • Create A C# Script
  • Write Code In Script or Download Script From Below Button
  • Make Camera Child Of GameObject For Camera Tracking

Code

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

public class Force : MonoBehaviour
{
    private void FixedUpdate()
    {
        GetComponent().AddForce(transform.forward * 5 * Time.deltaTime);
    }
}

Watch Tutorial Video

Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn
Happy
Happy
0 %
Sad
Sad
0 %
Excited
Excited
0 %
Sleepy
Sleepy
0 %
Angry
Angry
0 %
Surprise
Surprise
0 %

Average Rating

5 Star
0%
4 Star
0%
3 Star
0%
2 Star
0%
1 Star
0%

Leave a Reply

Your email address will not be published.

%d bloggers like this: