Skip to content

Commit

Permalink
Added support for VRCPlayerAPI.Immobilize
Browse files Browse the repository at this point in the history
  • Loading branch information
CyanLaser committed Jan 24, 2021
1 parent da7b431 commit bec15a6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions CyanEmu/Scripts/CyanEmuPlayerController.cs
Expand Up @@ -59,6 +59,7 @@ private enum Stance {

private Stance stance_;
private bool isDead_;
private bool isImmobile_;
private bool isWalking_;

private float walkSpeed_ = DEFAULT_WALK_SPEED_;
Expand Down Expand Up @@ -560,6 +561,11 @@ public void PlayerRevived()
isDead_ = false;
}

public void Immobilize(bool immobilize)
{
isImmobile_ = immobilize;
}

private void Update()
{
RotateView();
Expand Down Expand Up @@ -599,6 +605,12 @@ private void FixedUpdate()
jump_ = false;
}

// Immobile does not affect Jump
if (isImmobile_)
{
input = Vector2.zero;
}

// always move along the camera forward as it is the direction that it being aimed at
Vector3 desiredMove = transform.forward * input.y * speed.x + transform.right * input.x * speed.y;
desiredMove.y = 0;
Expand Down
2 changes: 1 addition & 1 deletion CyanEmu/Scripts/CyanEmuPlayerManager.cs
Expand Up @@ -153,7 +153,7 @@ public static void Immobilize(VRCPlayerApi player, bool immobilized)
throw new Exception("[VRCPlayerAPI.Immobilize] You cannot set remote players Immobilized");
}

// TODO
player.GetPlayerController().Immobilize(immobilized);
}

public static void TeleportToOrientationLerp(VRCPlayerApi player, Vector3 position, Quaternion rotation, VRC_SceneDescriptor.SpawnOrientation orientation, bool lerp)
Expand Down

0 comments on commit bec15a6

Please sign in to comment.