Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
0.8.3:charactercontrolling [2020/11/17 18:53] – external edit 127.0.0.10.8.3:charactercontrolling [2022/04/08 10:52] (current) – [Movement] admin
Line 12: Line 12:
 All character controllers receive inputs from a TGorillaInputController instance. By those inputs a linked camera component will be moved or All character controllers receive inputs from a TGorillaInputController instance. By those inputs a linked camera component will be moved or
 users are allowed to interact with your game. users are allowed to interact with your game.
 +
 +===== Hotkeys =====
 +
 +Because we've link an input controller to the character controller, we have to define hotkeys to react on.
 +In short this means: if the input controller detects a hotkey, it will forward the event to the character controller.
 +And then the character controller will react on the hotkey event by a specific operation, like moving forwared or shooting.
 +
 +By default the character controllery already defines standardized hotkeys, like W-A-S-D for movement.
 +But you're allowed to overwrite those hotkeys by your own.
  
 Predefined input hotkeys by the TGorillaCharacterController class are: Predefined input hotkeys by the TGorillaCharacterController class are:
 +
 +==== Predefined ====
  
 ^NAME ^CODE ^DEVICE ^ ^NAME ^CODE ^DEVICE ^
Line 60: Line 71:
 |GAMEPAD_MENU_LEFT|GORILLA_INPUT_GAMEPAD_DPAD_LEFT|GamePad| |GAMEPAD_MENU_LEFT|GORILLA_INPUT_GAMEPAD_DPAD_LEFT|GamePad|
 |GAMEPAD_MENU_RIGHT|GORILLA_INPUT_GAMEPAD_DPAD_RIGHT|GamePad| |GAMEPAD_MENU_RIGHT|GORILLA_INPUT_GAMEPAD_DPAD_RIGHT|GamePad|
 +
 +__**Remark:**__ All available input codes are defined in **Gorilla.Controller.Input.Consts.pas**.
 +
 +==== User-Friendly Events  ====
  
 For individual treatment you can disable or overwrite those predefined hotkeys. For individual treatment you can disable or overwrite those predefined hotkeys.
-The basis character controller component catches all input events, handles them throws user-friendly events.+The basis character controller component catches all input events, handles them and throws back user-friendly events.
  
 ^Event ^Description^ ^Event ^Description^
Line 84: Line 99:
 |OnTriggerPoint |If a TGorillaTriggerPointManager component was linked to the first person controller, a trigger-point check will automatically be performed on movement. If then a trigger-point is in reach, the OnTriggerPoint event will be raised.| |OnTriggerPoint |If a TGorillaTriggerPointManager component was linked to the first person controller, a trigger-point check will automatically be performed on movement. If then a trigger-point is in reach, the OnTriggerPoint event will be raised.|
  
-Basic movement configuration:+==== Movement  ==== 
 + 
 +Because movement is not always equal in every game, we implemented some easy-to-use property to control it.
  
 ^Property ^Description ^ ^Property ^Description ^
Line 173: Line 190:
  
  
-===== Optional linkable components =====+===== Optionally linkable components =====
  
 It's usual to handle different things during character controlling. So you'd like to check for special positions in 3D space and execute actions when getting triggered. Or you like to playback sounds on specific states or refer to a sound-map. It's usual to handle different things during character controlling. So you'd like to check for special positions in 3D space and execute actions when getting triggered. Or you like to playback sounds on specific states or refer to a sound-map.
Line 420: Line 437:
 </file> </file>
  
-Next step: [[android|Android]]+==== Movement ==== 
 + 
 +Since the latest version of Gorilla3D (v0.8.3.1995) we support kinematic character movement. 
 +While previous versions worked completely on physics computation, the latest change added a more stable way. 
 + 
 +The true physics collision detection for characters works, but has bad sideeffects. 
 +The most serious problem was stuttering characters which bounced off the terrain. 
 +Also it was impossible to "climb" up steep hills because physics always dragged you down again. 
 +Even if this is more realistic, the usability was horrible for classic character movement. 
 + 
 +So in the latest component state the "UseRayCasting" property is activated. This changes the character controller from a dynamic rigid body to a kinematic body. 
 +Here we now cast a ray to detect the current position on objects instead of letting physics do the job. 
 +Nevertheless interaction with static or dynamic objects is still available. 
 + 
 +__Remark:__ In case you need the old behaviour, just switch "UseRayCasting" to FALSE. 
 + 
 +Control you raycast-movement by some properties like Slop, RayDirection and RayOffset. 
 +Especially the slopping value allows you to control f.e. the max. height of stairs to be able to walk. 
 + 
 +^Property^Description^ 
 +|Slop|This only affects computation if UseRayCasting is enabled. The slop value is the maximum height a movement ray direction. Adjust this value to your specific scene, especially when walking of stairs or similar static objects. Default value is 0.5.| 
 +|RayDirection|The RayDirection defines in which direction the controller will be adjusted. Default direction is (0, 1, 0), which means downwards.| 
 +|RayOffset|Get or set ray offset from where the raycasting is started. The offset will be computed from current physics character controller position.| 
 + 
 +Next step: [[prefabs|Prefabs]]