I am trying to make a 3D capsule climb up along an object I tagged as "Wall". However, when I make contact with the wall, It can't seem to rise along the wall. How would this be fixed?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class WallClimb : MonoBehaviour
{
public float riseSpeed;
public Rigidbody rb;
private void start()
{
riseSpeed = 5.0f;
}
private void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.CompareTag("Wall"))
{
Debug.Log("Position: " + transform.position);
rb.velocity = transform.up * riseSpeed;
Debug.Log("Wall Hit");
}
}
}