- Home /
Question by
vince1995 · Jul 05, 2017 at 05:32 PM ·
c#rigidbodyyfreezeposition
RigidbodyConstraints.FreezePositionY doesn't freeze the position
Here's my script:
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class MaxY : MonoBehaviour { public bool isHeightLocked; private RigidbodyConstraints freeze; void Start() { isHeightLocked = new bool(); freeze = new RigidbodyConstraints (); } // Update is called once per frame void Update () { if (Input.GetKeyDown (KeyCode.E)) { isHeightLocked = true; } if (isHeightLocked == true) { freeze = RigidbodyConstraints.FreezePositionY; } } }
Thank you for helping!
Comment