I am very new to unity and am currently making a very simple game. so far its a game where a cube can move around and jump, i set up two walls and wanted to create a wall jump mechanic but i was totally lost. If you can help, that would be great. If this helps here is my jump script:
using UnityEngine;
using System.Collections;
[RequireComponent(typeof(Rigidbody))]
public class Jump : MonoBehaviour
{
public Vector3 jump;
public float jumpForce = 2.0f;
public bool isGrounded;
Rigidbody rb;
void Start()
{
rb = GetComponent<Rigidbody>();
jump = new Vector3(0.0f, 2.0f, 0.0f);
}
void OnCollisionStay()
{
isGrounded = true;
}
void Update()
{
if (Input.GetKeyDown(KeyCode.Space) && isGrounded)
{
rb.AddForce(jump * jumpForce, ForceMode.Impulse);
isGrounded = false;
}
}
}
`