disable player movement
ok, read the forum and tried the scripts but nothing worked as I tried to adapt them for my purposes. Since free unity can't use movies as a texture I am doing a work around for a cutscene. I have the player entering a trigger that switches out the camera from game camera to a still camera. That trigger zone also starts the animations for the cut scene. All is well. But I want to disable the player so the user can't be running around while cutscene is playing. I tried adapting the scripts I found but no luck. Tried parenting the player to an object also in the trigger zone as well as disabling his movement script. The script that I want to disable is called PlayerMovement. here is what I have - or one version of what I have tried, Trying to freeze the player for 3 seconds. period`using UnityEngine; using System.Collections;
public class parentPlayer : MonoBehaviour { public playerMovement playerMovementRef;
void OnTriggerEnter (Collider other)
{
if(other.gameObject == player)
StartCoroutine("DisableScript");
{
IEnumerator DisableScript ()
{
playerMovementRef.enabled = false;
yield return new WaitForSeconds (3f);
playerMovementRef.enables=true;
}
}`
Answer by vittu1994 · May 16, 2016 at 09:41 PM
PlayerGameObject.SetActive(false);
This will disable the player and make them invisible and u cant access any scripts on the object (like a playermovement script).
Or do you want the player to stay visible?
Yes, I want the player to stay visible. I just want to stop movement on keypress.
Your answer
Follow this Question
Related Questions
How do i freeze the player for the firs 3 second? 1 Answer
Player does not jump? 0 Answers
Movement with joystick ,Moving object with the Joystck 0 Answers
Player rapidly stutters back and forth while moving 0 Answers
Simple Host - Client Callback 0 Answers