Realistic Sniper and Ballistics
  • Welcome
  • Introduction
    • Feature List
    • Why/How is it used?
    • Quick Setup
  • Getting Started
    • Getting Started
    • Environment Properties
    • Bullet Properties
    • Object Poolers
    • Sniper and Ballistics System
    • Firing a Bullet
    • Listening to Hit Events
      • Spawning Particles on Hit
      • Hit Tags
    • Zero Distances
    • Wind Vector
    • Air Resistance
    • Spin Drift
    • Ballistic Surfaces - Penetration
    • Ballistic Surfaces - Ricochet
    • Bullet Time Effects
      • Target
      • Bullet
      • Firing with Bullet Time
      • Bullet Time Camera - Default
      • Writing your Own Bullet Time Camera
    • Dynamic Scope System
    • Incorporating Player
      • Player Movement Controller
      • Motion Controller
      • Camera Controller
      • Player With Weapon
    • Mobile Controls
    • Conclusion
  • API
    • API Welcome
    • Sniper and Ballistics System
    • Dynamic Scope System
    • Player Movement Controller
    • Motion Controller
    • Ballistic Surface
    • Environment Properties
    • Ballistics Utility
    • Bullet Time Utility
Powered by GitBook
On this page

Was this helpful?

  1. Getting Started
  2. Incorporating Player

Motion Controller

PreviousPlayer Movement ControllerNextCamera Controller

Last updated 3 years ago

Was this helpful?

If you continue looking down the hirarchy of the Player Without Weapon prefab, you will see a Camera Animator object. This is simply an example animator that animates a "camera-kick" effect when the player fires. Below that, we have Camera Motion Controller object, which has MotionController.cs component attached to it.

This motion controller is the script that handles various effects to give life to the camera object.

  • BobMotion: Bobs the camera with sine waves based on whether the player is walking or running.

  • Key & Mouse Sway: Sways the camera's rotation based on keyboard & mouse input.

  • Recoil Motion: Recoils camera when player fires.

  • Breath Sway: When player aims, enables a sway effect mimicking player moving the weapon due to breathing. Player can hold shift to stabilize.

  • Positioner: Can place the object to hip, aim or running position, based on whatever method is called. Is not being used in here, but will be used for weapon.

BobMotion and Key&Mouse Sway works individually, one of them is based on player movement events coming from PlayerMovementController.cs and the other one is solely based on key&mouse inputs. Recoil Motion requires you to call Recoil() method in MotionController.cs, same for using BreathSway and Positioner behaviors. Since our player prefab doesn't have a weapon now, these effects are enabled but there is no-one calling them.

MotionController.cs attached to the child object of Camera Animator, which is a child of Player Without Weapon prefab.