MMO RPG Camera & Controller Manual
User Manual:
Open the PDF directly: View PDF .
Page Count: 7
Download | |
Open PDF In Browser | View PDF |
Table of contents: 1 1.1 1.2 1.3 1.4 1.5 1.6 2 3 4 Getting started Attaching the scripts Creating the needed Inputs Adding animations Assigning the right layer (optional) Tagging objects right (optional) Using the correct shader (optional) Variable overview and explanation Version history Got questions or problems? 1 Getting started 1.1 Attaching the scripts • • • Attach the script “RPGCamera.cs” to your character game object if you’d like to have the camera controls Attach the script “RPGController.cs” to your character game object if you’d like to have the character controls Attach the script “RPGMotor.cs” only if you’d like to use your own controller script but use my motor script 1.2 Creating the needed Inputs Set up the following Inputs in the Project Input Settings (Edit > Project Settings > Input). The used buttons shown in the pictures are the same as in the demo – of course you can use whatever buttons you want. 1.3 Adding animations Just add the provided Animator component (Resources > CharacterAnimator) to your character game object and assign the desired animations to their corresponding states in the Animator tab. Now you should be good to go! 1.4 Assigning the right layer (optional) The default value for the variable “Occluding Layers” of the RPG View Frustum is the “Default” layer mask. Therefore, if your character game object has the layer “Default” assigned, it will be faded out slightly when its materials has a transparent shader set. If you want your character to be set up like the one in the demo, you have to set its layer to “Ignore Raycast” or any layer which is not part of the “Occluding Layers” layer mask (e.g. a new one called “Player”). 1.5 Tagging objects right (optional) By default the variable “Occlusion Handling” of the RPG View Frustum is set to “Tag Dependent”. So every game object with a tag contained in the “Affecting Tags” list of the RPG View Frustum forces the camera to zoom in. For example, the tag “AffectCameraZoom” is an affecting tag by default and if you assign it to a wall object, the camera will zoom in when the wall enters the view frustum. 1.6 Using the correct shader (optional) If you want to use the fading feature of the RPG View Frustum, the objects you’d like to see fade have to have a material with a transparent shader attached. You can use the shader I used for the demo (Resources > Transparent Bumped Diffuse) if you want. It is a simple bumped diffuse shader with transparency and Z-buffering enabled. 2 Variable overview and explanation Here I’m going to explain some public variables and what they do as their names may not be self-explanatory. For a complete variable overview please go to johnstairs.com. RPG Camera Used Camera References the camera object used by the script. If no camera is assigned to this variable, a new one will be generated automatically when entering the play mode. Used Skybox This is the current skybox used by the camera referenced by UsedCamera. The skybox can be changed at runtime by calling the RPGCamera script’s method “SetUsedSkybox(material)”. Direct assignments to this variable won’t take effect. Camera Pivot Local Position This is the local position of the camera pivot, the “anchor” of the camera. Turn on the script’s Gizmos to visualize it as a small cyan sphere. Activate Camera Control If set to false, all camera controls are disabled. Can be used to turn off the camera when interacting with a GUI (e.g. see the demo GUI interaction). Always Rotate Camera If set to true, you don’t have to press “Fire1” or “Fire2” to control the camera. Align Character Determines when the character’s view/walking direction should be aligned to the camera’s view direction. By default, the character is only aligned with the camera when “Fire2” is pressed. Align Camera When Moving If set to true, the camera view direction aligns with the character’s view/walking direction when the character starts to move (forward/backwards/strafe). If additionally Support Walking Backwards is set to true, the camera faces the front of the character when walking backwards. RPG View Frustum Occlusion Handling, Occluding Layers and Affecting Tags These three variables might be the most difficult ones to understand. Therefore, a larger explanation follows: When a game object enters the camera’s view frustum and has an occluding layer assigned, it gets affected (faded out) or affects the camera zoom (lets the camera zoom in) depending on the “Occlusion Handling” ∗ “Occlusion Handling” controls how the camera reacts on objects inside its view frustum: “Do Nothing” - every object is ignored and has no effect “Always Zoom In” - every object forces the camera to zoom in to retrieve a clear sight on the camera’s pivot “Tag Dependent” – every object with a tag contained in the “Affecting Tags” list forces the camera to zoom in. Every object which has an occluding layer and no affecting tag assigned gets faded out when entering the frustum and faded back in when leaving the frustum ∗ Fade Out Alpha The alpha to which objects fade out when they enter the view frustum. Fade In Alpha The alpha to which objects fade back in after they left the view frustum. Enable Character Fading If set to true, the character starts to fade when the camera’s distance to its pivot is smaller than the “Character Fade Start Distance”. Character Fade Start Distance This is the distance between the camera and its pivot where the character fading starts. Character Fade End Distance This is the distance between the camera and its pivot where the character is completely faded out to “Character Fade Out Alpha”. RPG Motor Allowed Airborne Moves The character is allowed to move slightly while airborne after performing a standing jump. This variable saves the maximum number of allowed airborne moves. Sliding Threshold The value of this variable represents the terrain/ground angle at which the character starts to slide down. Therefore, a value of “40” means that the character object starts to slide off every hill or surface which is steeper than 40 degrees. Falling Threshold A value representing the degree at which the character starts to fall. The default value is “6” to let the character be grounded when walking down small hills. 3 Version history v3.6 ∗ Introduced new RPGMotor variable “Unlimited Airborne Moves”. If set to true, the number of allowed moves while airborne is unlimited ∗ Introduced new RPGMotor method “Stun(duration)” which stuns the character for “duration” seconds, disabling movement and transitioning into the new “Stunned” animator state ∗ Introduced new RPGCamera variable “Align Character Speed” which controls the character-to-camera turning speed. ∗ Character fading now correctly depends on the distance between the camera and the character ∗ Small logical adjustments v3.5 ∗ Introduced new RPGMotor variable “Move With Moving Ground”. If set to true, the character will stay on moving objects like moving platforms ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ Introduced new RPGMotor variable “Rotate With Rotating Ground”. If set to true, the character will rotate with rotating objects while standing on them Introduced new RPGMotor variable “Ground Object Affects Jump”. If set to true, the jumping direction gets affected by the (moving) object the character was standing on Introduced new RPGCamera variable “Rotation Stopping Input” for setting which input should be pressed to pause automatic camera rotation with the character (only usable if “Rotate With Character” is set to “Rotation Stopping Input”) Introduced new RPGCamera variable “Alignment Input” for setting which input should be pressed to align the character’s view direction with the camera view direction (only usable if “Align Character” is set to “On Alignment Input”) Updated the demo scenes for the new features Updated the GUI layout Updated the manual for using the RPGCamera with Unity’s ThirdPersonController standard asset Minor bugfixes v3.4 ∗ ∗ Fixed a bug when the RPGController and RPGCamera were used independently Added instructions to the Documentation folder for using the RPGCamera with Unity’s ThirdPersonController standard asset ∗ New RPGCamera variable “Rotate With Character” which lets you set if the camera should rotate as well when the character turns ∗ Minor code additions and changes v3.3 ∗ When LM is pressed, the camera doesn’t rotate with the character anymore ∗ When jumping into objects from below, the character bounces off immediately ∗ Introduced new RPGCamera variable “Support Walking Backwards” for better character alignment when walking backwards ∗ Improved the provided demo shader ∗ Fixed a bug where it was possible to turn the camera upside down in first-person mode v3.2 ∗ Fixed a bug in first person view which caused the camera to behave incorrectly ∗ Fixed a bug where it was possible to force the camera under terrain for a few frames ∗ Added the possibility to group the RPGCamera script variables in the inspector v3.1 ∗ Fixed an animation bug in the demo caused by Unity’s new editor version 5.1.1f1 ∗ Improved interleaving of scripts ∗ Improved RPGController and RPGMotor scripts ∗ Implemented a better approach for camera rotation ∗ Introduced new RPGCamera variables: ∗ Used Skybox ∗ Constrain Mouse X ∗ Mouse X Min ∗ Mouse X Max ∗ ∗ Moved the variable “Align Character With Camera” to RPGCamera and renamed it to “Align Character” to improve readability and efficiency Updated manual instructions v3.0 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ Added animations controlled by Mecanim Added a walking toggle Object fading between the camera and its pivot Different occlusion handling modes selectable Tag dependent camera zoom enforcement (easy setup in the inspector) Slower backwards walking if desired 21 new public variables for easier and more customization New GUI for the demo Replaced the RPGClipPlane by the RPGViewFrustum and moved view frustum computations there ∗ Removed a bug where you could jump while sliding resulting in greater jumps v2.1 ∗ Update for Unity 5 v2.0 ∗ ∗ ∗ ∗ Complete revision Huge amount of new controller and camera features added UML diagram included Let out the animation scripting v1.1 ∗ ∗ ∗ ∗ ∗ Added the “RPG_Animation” script Added a capsule model with animation clips attached to it Changed object hierarchy of the “PlayerChar” object The cursor is not locked anymore if you press the left mouse New public variable “fallingThreshold” in “RPG_Controller” defining the terrain height at which the character starts to stumble ∗ Setting the layer of PlayerChar to “Ignore Raycast” is not necessary anymore ∗ Some code and names improved/edited for clearer understanding 4 Got questions or problems? Feel free to send me an email to mail@johnstairs.com if your question isn’t covered by the FAQs on johnstairs.com! Please attach a screenshot showing the used variable values and occurring error messages. Best regards, John Stairs
Source Exif Data:
File Type : PDF File Type Extension : pdf MIME Type : application/pdf PDF Version : 1.5 Linearized : Yes Author : John Stairs Company : Create Date : 2018:01:21 22:26:58+01:00 Modify Date : 2018:01:21 22:27:00+01:00 Source Modified : D:20180121212653 Tagged PDF : Yes XMP Toolkit : Adobe XMP Core 5.2-c001 63.139439, 2010/09/27-13:37:26 Metadata Date : 2018:01:21 22:27+01:00 Creator Tool : Acrobat PDFMaker 10.1 für Word Document ID : uuid:f7226d33-92d7-4575-9a9d-587f61e1d279 Instance ID : uuid:cb259d84-a058-4142-9bdc-834707351a40 Subject : 129 Format : application/pdf Title : MMO RPG Camera & Controller Manual Creator : John Stairs Producer : Adobe PDF Library 10.0 Page Layout : OneColumn Page Count : 7EXIF Metadata provided by EXIF.tools