top of page

Physics Game

Solo Project

OVERVIEW

TOOLS

Unity

This project was created for Maths and Physics module.

Objective was to create a game based on real life physics equations.

​

I've created a game where you play as a rocket pilot and your main objective is to transport elements from point A to point B. The catch is that there are obstacles along the way that if you touch them you need to start game from the beggining. You can also run out of fuel.

LANGUAGE

C#

MEDIA GALLERY

Screenshot 2022-10-01 at 13.57.03.png

SAMPLE CODE

attach class

.

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

 

public class attach : MonoBehaviour

{

    public Transform rope;

    public Rigidbody rb;

    Vector3 diff = new Vector3(0,0.5f,0);

    int i = 0;

 

    void grab()

    {

            rb = GetComponent<Rigidbody>();

            this.transform.position = rope.position;

            this.transform.position = rope.position - diff;

            this.transform.parent = GameObject.Find("EndRope").transform;

    }

 

    private void drop()

    {

        if (Input.GetKey(KeyCode.Space))

        {

            this.transform.parent = null;

            i = 0;

        }

    }

 

    // Update is called once per frame

    void Update()

    {   if(Vector3.Distance(transform.position, rope.position) <= 1)

        {

            i = 1;

        }

        if(i == 1)

        {

            grab();

        }

 

 

        drop();

    }

}

bottom of page