Jack Reggin

Gameplay Programmer

Jack Reggin

Gameplay Programmer

No Ghosts, demons talk allowed to here em!
Genre Chaotic Management Game
Engine Unity
Role(s) Gameplay Programmer
Language(s) C#
Team Size 4
Duration 48 hours
Genre Chaotic Management Game
Engine Unity
Role(s) Gameplay Programmer
Language(s) C#
Team Size 4
Duration 48 hours
No Ghosts, demons talk allowed to here em! is a game that was made at the Global Game Jam 2018 hosted at NHTV Breda. The theme of the game jam was Transmission. It took inspiration from games such as Surgeon Simulator & Papers Please. My role within this game was mainly to create the core gameplay mechanic of being able to interact with objects in the world using just a mouse.
See the GIF below to see how this system works.

Hand Plane Rotation

Hand Plane I was having a very hard time trying to get something that felt easy enough to use just the mouse to interact with objects in the world while making it not seem sloppy since players would be interacting with physics objects. I took a look at how Surgeon Simulator handled their interactions and they use both the mouse and the keyboard. I tried this method but it didn't feel quite right in our game since we'd have much more sporadic shaking and so wanted to be able to move the mouse really fast instead of very precisely.
private void Update()
{
  if (_startTransition)
  {
    var newAngle = Mathf.SmoothDampAngle(transform.eulerAngles.x,
    TargetHeightPlaneRotation, ref _velocity, TransitionTime);
    transform.rotation =
    Quaternion.Euler(newAngle, transform.eulerAngles.y, transform.eulerAngles.z);

    ...
  }
  ...
}
_startTransition is set to true when the mouse hovers over a UI element on the top or bottom of the screen. By using SmoothDampAngle I am able to get a very nice smooth transition from the one rotation to the other.
private void Update()
{
  if (_startTransition)
  {
    ...

    if (Mathf.Abs(TargetHeightPlaneRotation - newAngle) <= Threshold)
    {
      var switchRotation = TargetHeightPlaneRotation;
      TargetHeightPlaneRotation = _startHeightPlaneRotation;
      _startHeightPlaneRotation = switchRotation;

      _startTransition = false;
    }
  }
  ...
}
Above is just a simple check to see when the rotation of the plane hits within a certain threshold to stop rotating and get ready for the next transition.

Hand Plane Movement

Within the same GIF above the plane moves up and down. This is how the players are able to move the hand to pick up objects in the world and interact with them. Since the plane could be in any rotation, I needed a way to move the plane irregardless of which direction it was facing. The way that I solved this was by having a parent transform and having the actual plane a child of transform in order that I may move the local position and always have the plane move around a single point in the world.
private void Update()
{
    if (_startTransition)
    {
        ...
    }
    else
    {
        var heightY = Input.GetMouseButton(0)
            ? HandPlaneTransform.localPosition.y - DropSpeed * Time.deltaTime
            : HandPlaneTransform.localPosition.y + DropSpeed * Time.deltaTime;
        heightY = heightY >= StartHeightY ? StartHeightY : heightY;
        heightY = Mathf.Abs(StartHeightY - heightY) >= HeightPlaneMin ? -HeightPlaneMin : heightY;

        HandPlaneTransform.localPosition = new Vector3(HandPlaneTransform.localPosition.x,
            heightY,
            HandPlaneTransform.localPosition.z);
    }
}