{"id":1554,"date":"2020-06-29T00:00:25","date_gmt":"2020-06-29T00:00:25","guid":{"rendered":"https:\/\/castle-engine.io\/wp\/?p=1554"},"modified":"2020-06-29T00:11:52","modified_gmt":"2020-06-29T00:11:52","slug":"third-person-navigation-with-avatar-component-in-castle-game-engine","status":"publish","type":"post","link":"https:\/\/castle-engine.io\/wp\/2020\/06\/29\/third-person-navigation-with-avatar-component-in-castle-game-engine\/","title":{"rendered":"Third-Person Navigation (with Avatar) component  in Castle Game Engine"},"content":{"rendered":"<table class=\"thumbnails thumbnails-align-right\"><tr><td>\n          <a href=\"https:\/\/castle-engine.io\/wp\/wp-content\/uploads\/2020\/06\/third_person_camera_screen_2.png\"\n             class=\"screenshot\"\n             title=\"third_person_camera_screen_2\"><img loading=\"lazy\" decoding=\"async\"\n            style=\"float: right\"\n            src=\"https:\/\/castle-engine.io\/wp\/wp-content\/uploads\/2020\/06\/third_person_camera_screen_2-200x103.png\"\n             width=\"200\" height=\"103\" \n            alt=\"third_person_camera_screen_2\"\n          ><\/a><\/td><\/tr><tr><td>\n          <a href=\"https:\/\/castle-engine.io\/wp\/wp-content\/uploads\/2020\/06\/third_person_camera_screen_3.png\"\n             class=\"screenshot\"\n             title=\"third_person_camera_screen_3\"><img loading=\"lazy\" decoding=\"async\"\n            style=\"float: right\"\n            src=\"https:\/\/castle-engine.io\/wp\/wp-content\/uploads\/2020\/06\/third_person_camera_screen_3-200x103.png\"\n             width=\"200\" height=\"103\" \n            alt=\"third_person_camera_screen_3\"\n          ><\/a><\/td><\/tr><tr><td>\n          <a href=\"https:\/\/castle-engine.io\/wp\/wp-content\/uploads\/2020\/06\/third_person_camera_screen_4.png\"\n             class=\"screenshot\"\n             title=\"third_person_camera_screen_4\"><img loading=\"lazy\" decoding=\"async\"\n            style=\"float: right\"\n            src=\"https:\/\/castle-engine.io\/wp\/wp-content\/uploads\/2020\/06\/third_person_camera_screen_4-200x103.png\"\n             width=\"200\" height=\"103\" \n            alt=\"third_person_camera_screen_4\"\n          ><\/a><\/td><\/tr><tr><td>\n          <a href=\"https:\/\/castle-engine.io\/wp\/wp-content\/uploads\/2020\/06\/third_person_camera_screen_6.png\"\n             class=\"screenshot\"\n             title=\"third_person_camera_screen_6\"><img loading=\"lazy\" decoding=\"async\"\n            style=\"float: right\"\n            src=\"https:\/\/castle-engine.io\/wp\/wp-content\/uploads\/2020\/06\/third_person_camera_screen_6-200x103.png\"\n             width=\"200\" height=\"103\" \n            alt=\"third_person_camera_screen_6\"\n          ><\/a><\/td><\/tr><tr><td>\n          <a href=\"https:\/\/castle-engine.io\/wp\/wp-content\/uploads\/2020\/06\/fps_game_screen_5.png\"\n             class=\"screenshot\"\n             title=\"fps_game_screen_5\"><img loading=\"lazy\" decoding=\"async\"\n            style=\"float: right\"\n            src=\"https:\/\/castle-engine.io\/wp\/wp-content\/uploads\/2020\/06\/fps_game_screen_5-200x113.png\"\n             width=\"200\" height=\"113\" \n            alt=\"fps_game_screen_5\"\n          ><\/a><\/td><\/tr><tr><td>\n          <a href=\"https:\/\/castle-engine.io\/wp\/wp-content\/uploads\/2020\/06\/fps_game_screen_6.png\"\n             class=\"screenshot\"\n             title=\"fps_game_screen_6\"><img loading=\"lazy\" decoding=\"async\"\n            style=\"float: right\"\n            src=\"https:\/\/castle-engine.io\/wp\/wp-content\/uploads\/2020\/06\/fps_game_screen_6-200x113.png\"\n             width=\"200\" height=\"113\" \n            alt=\"fps_game_screen_6\"\n          ><\/a><\/td><\/tr><tr><td>\n          <a href=\"https:\/\/castle-engine.io\/wp\/wp-content\/uploads\/2020\/06\/fps_game_screen_7.png\"\n             class=\"screenshot\"\n             title=\"fps_game_screen_7\"><img loading=\"lazy\" decoding=\"async\"\n            style=\"float: right\"\n            src=\"https:\/\/castle-engine.io\/wp\/wp-content\/uploads\/2020\/06\/fps_game_screen_7-200x113.png\"\n             width=\"200\" height=\"113\" \n            alt=\"fps_game_screen_7\"\n          ><\/a><\/td><\/tr><\/table>\n<p>We present a new <i>Castle Game Engine<\/i> component <a href=\"https:\/\/castle-engine.io\/apidoc-unstable\/html\/CastleThirdPersonNavigation.TCastleThirdPersonNavigation.html\">TCastleThirdPersonNavigation<\/a>. You can use it easily with TCastleViewport to have a working 3rd-person navigation. This means that you control an avatar with keys (ASWD QE), and the mouse orbits around the avatar, who is displayed and animated in front of the camera.<\/p>\n<p><iframe loading=\"lazy\" width=\"560\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/_afvXvhv9Ek\" frameborder=\"0\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/p>\n<p>Features:<\/p>\n<ul>\n<li>You can move the camera around the avatar and control the avatar in various ways. All the inputs are configurable.\n<li>\n<p>Avatar can run, crouch, with collisions, with gravity.<\/p>\n<li>\n<p>Camera follows avatar smoothly and avoids being blocked by walls.<\/p>\n<li>\n<p>Mouse can optionally also &#8220;aim&#8221; the avatar, which makes it easier to rotate the avatar. OTOH, it makes it harder to look at avatar&#8217;s front, e.g. at avatar&#8217;s face.<\/p>\n<li>\n<p>You can look closer\/further at the avatar.<\/p>\n<li>\n<p>Avatar can have gravity enabled, so it can fall down and climb stairs correctly.\n<\/ul>\n<p>It is all <a href=\"https:\/\/castle-engine.io\/apidoc-unstable\/html\/CastleThirdPersonNavigation.TCastleThirdPersonNavigation.html\">documented in our API<\/a>. There&#8217;s a lot of published properties to play with.<\/p>\n<p>You can trivially use it with <a href=\"https:\/\/castle-engine.io\/manual_editor.php\">CGE editor<\/a>. Just select a viewport and, using the menu, change the Navigation to be TCastleThirdPersonNavigation. Remember to also assign the <a href=\"https:\/\/castle-engine.io\/apidoc-unstable\/html\/CastleThirdPersonNavigation.TCastleThirdPersonNavigation.html#Avatar\">Avatar<\/a> property.<\/p>\n<p>The full demo is in engine sources, in <a href=\"https:\/\/github.com\/castle-engine\/castle-engine\/tree\/master\/examples\/third_person_camera\">examples\/third_person_camera<\/a>. Just <a href=\"https:\/\/castle-engine.io\/\">download the latest engine<\/a> and open &#8220;examples\/third_person_camera\/&#8221; project in the CGE editor.<\/p>\n<p>The <a href=\"https:\/\/github.com\/castle-engine\/castle-engine\/tree\/master\/examples\/fps_game\">examples\/fps_game<\/a> was also updated to show how to use 3rd-person navigation together with <a href=\"https:\/\/castle-engine.io\/manual_3d_utlities_overview.php\">TPlayer and TLevel classes<\/a>. Just uncomment <code>SetupThirdPersonNavigation<\/code> call in the sample code to have it working.<\/p>\n<p>This work has been sponsored through <a href=\"https:\/\/www.patreon.com\/castleengine\">Castle Game Engine Patreon<\/a>. In particular thanks to <i>Ramazan Geven<\/i> and <i>Robert Daniel Murphy<\/i> for donating and requesting this feature! If you like what I&#8217;m doing &mdash; please <a href=\"https:\/\/www.patreon.com\/castleengine\">support me on Patreon<\/a>. Thank you!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We present a new Castle Game Engine component TCastleThirdPersonNavigation. You can use it easily with TCastleViewport to have a working 3rd-person navigation. This means that you control an avatar with keys (ASWD QE), and the mouse orbits around the avatar, who is displayed and animated in front of the camera. Features: You can move the &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/castle-engine.io\/wp\/2020\/06\/29\/third-person-navigation-with-avatar-component-in-castle-game-engine\/\" class=\"more-link\">Continue reading  \u27a4<span class=\"screen-reader-text\"> &#8220;Third-Person Navigation (with Avatar) component  in Castle Game Engine&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":1561,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"publish_to_discourse":"0","publish_post_category":"9","wpdc_auto_publish_overridden":"1","wpdc_topic_tags":"","wpdc_pin_topic":"","wpdc_pin_until":"","discourse_post_id":"486","discourse_permalink":"https:\/\/forum.castle-engine.io\/t\/third-person-navigation-with-avatar-component-in-castle-game-engine\/173","wpdc_publishing_response":"","wpdc_publishing_error":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"Third-Person Navigation (Avatar) component  in Castle Game Engine","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1],"tags":[],"class_list":["post-1554","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/castle-engine.io\/wp\/wp-content\/uploads\/2020\/06\/third_person_camera_screen_2.png","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9IgYW-p4","jetpack_likes_enabled":false,"_links":{"self":[{"href":"https:\/\/castle-engine.io\/wp\/wp-json\/wp\/v2\/posts\/1554","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/castle-engine.io\/wp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/castle-engine.io\/wp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/castle-engine.io\/wp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/castle-engine.io\/wp\/wp-json\/wp\/v2\/comments?post=1554"}],"version-history":[{"count":6,"href":"https:\/\/castle-engine.io\/wp\/wp-json\/wp\/v2\/posts\/1554\/revisions"}],"predecessor-version":[{"id":1567,"href":"https:\/\/castle-engine.io\/wp\/wp-json\/wp\/v2\/posts\/1554\/revisions\/1567"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/castle-engine.io\/wp\/wp-json\/wp\/v2\/media\/1561"}],"wp:attachment":[{"href":"https:\/\/castle-engine.io\/wp\/wp-json\/wp\/v2\/media?parent=1554"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/castle-engine.io\/wp\/wp-json\/wp\/v2\/categories?post=1554"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/castle-engine.io\/wp\/wp-json\/wp\/v2\/tags?post=1554"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}