i am an absolute beginner and i would appreciate any help in creating a script… or if anyone has a script i would appreciate that… cheers
This should help you with the movement part of being under water, but when you use this make sure the player has air control. Just attach this to a trigger on the water:
public class GravityChange : MonoBehaviour {
void OnTriggerEnter(Collider Collider)
{
if (Collider.gameObject.tag == "Player")
{
Physics.gravity = new Vector3(0, -1F, 0);
}
}
void OnTriggerExit(Collider Collider)
{
if (Collider.gameObject.tag == "Player")
{
Physics.gravity = new Vector3(0, -10F, 0);
}
}
}
I was trying to do this and can’t as well. I followed whereswaldo’s advice and it didnt work. Mine is 2d…
.