Skip to content

Instantly share code, notes, and snippets.

@EsteveSegura
Created March 9, 2020 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EsteveSegura/b218595cacaded9b958f5bee184bd105 to your computer and use it in GitHub Desktop.
Save EsteveSegura/b218595cacaded9b958f5bee184bd105 to your computer and use it in GitHub Desktop.
Ball controller.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Ball : MonoBehaviour{
public Rigidbody rb;
public float force;
void Start(){
force = 400f;
rb = GetComponent<Rigidbody>();
}
public void Jump(){
rb.AddForce(new Vector3(0,1 * force,0));
}
public void Forward(){
rb.AddForce(new Vector3(0 , 0 , 1 * force));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment