- Home /
Question by
adamanderson16 · Oct 27, 2019 at 06:57 PM ·
gaming
Trying to create a jump pad for my character (3D)
I'm trying to create a jump pad for my character in my 3d world. I'm attempting to have the jump pad launch my character, by using the AddForce function, but it's not working. I have the pad set as a trigger, and the player tagged as player. Nevertheless, it's failing to launch my character.
Can anybody see what's going on here?
using System.Collections.Generic;
using UnityEngine;
public class Bounce : MonoBehaviour
{
public int jumpForce;
private void OnTriggerEnter(Collider other)
{
if (other.CompareTag("Player"))
{
other.GetComponent<Rigidbody>().AddForce(Vector3.up * jumpForce);
}
}
}
Comment