i need to check if The player is colliding with a trigger tagged “Dock” when they press “Q” and if its true then run “Water();” collision was never my forte so at the moment im pretty lost, especially since its been so long since ive done this. here’s what i have so far:
public class VehicleAccess : MonoBehaviour {
public bool AccessBoat = true;
public bool AccessCar = true;
public bool AccessAirship = true;
public GameObject Player;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
//If Q is pressed
if(Input.GetKeyDown (KeyCode.Q))
{
//check for player's collision with game object tagged Dock
//if true
Water();
}
}
//If player is trying to enter the Ship
void Water()
{
Debug.Log("Water");
}
}
I know its not much but as i said i was never good at collision, which is all i need to understand and implement the collision detection to move on.