{"id":25518,"date":"2022-01-11T21:50:04","date_gmt":"2022-01-11T18:50:04","guid":{"rendered":"https:\/\/mobidictum.com\/?p=25518"},"modified":"2023-04-25T10:48:30","modified_gmt":"2023-04-25T07:48:30","slug":"unity-lerp","status":"publish","type":"post","link":"https:\/\/mobidictum.com\/tr\/unity-lerp\/","title":{"rendered":"Unity&#8217;de Lerp fonksiyonu nas\u0131l kullan\u0131l\u0131r?"},"content":{"rendered":"\n<p>Lerp bir noktadan di\u011fer noktaya belli bir zamanda do\u011frusal \u00f6l\u00e7ekte gitmemizi yarayan fonksiyondur. <\/p>\n\n\n\n<p>Bu \u00f6l\u00e7ek tamam\u0131yla do\u011frusal da olabilir artarak gidiyor olabildi\u011fi gibi, ayr\u0131ca Unity i\u00e7erisinde bu bahsetti\u011fimiz noktalar Vector de olabilir: -Vector3.Lerp(Vector3 a, Vector3 b, float t)\u00a0kullan\u0131m\u0131 \u00f6rnek g\u00f6sterilebilir. Ek olarak bu de\u011fi\u015fken float tipinde de olabilir: Mathf.Lerp(float a , float b, float t)\u00a0kullan\u0131m\u0131 \u00f6rnek g\u00f6sterilebilir.<\/p>\n\n\n\n<h2 class=\"is-style-default wp-block-heading\"><strong>Vector3.Lerp()&nbsp;<\/strong><\/h2>\n\n\n\n<p>Vector3.Lerp(Vector3 a, Vector3 b, float t) \u015feklinde yaz\u0131lan fonksiyonumuz \u015fu form\u00fcl ile \u00e7al\u0131\u015f\u0131r: a+ (b-a) * t\u00a0\u00a0ve bu de\u011feri \u201creturn\u201d eder. Bu y\u00fczden kullan\u0131m yaparken bu de\u011feri de\u011fi\u015fmesini istedi\u011finiz de\u011fi\u015fkene e\u015fitlemeniz gerekir. <\/p>\n\n\n\n<p>\u00d6rne\u011fin objenizin pozisyonunu (0,5,0) pozisyonuna lerp i\u015flemi uygulayarak g\u00f6t\u00fcrmek istiyorsunuz. Bunun kodu \u015fu \u015fekilde olucakt\u0131r.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"908\" height=\"290\" src=\"https:\/\/mobidictum.com\/wp-content\/uploads\/2022\/01\/Unity-Lerp-Vector3.jpg\" alt=\"\" class=\"wp-image-25520\" srcset=\"https:\/\/mobidictum.com\/wp-content\/uploads\/2022\/01\/Unity-Lerp-Vector3.jpg 908w, https:\/\/mobidictum.com\/wp-content\/uploads\/2022\/01\/Unity-Lerp-Vector3-300x96.jpg 300w, https:\/\/mobidictum.com\/wp-content\/uploads\/2022\/01\/Unity-Lerp-Vector3-768x245.jpg 768w, https:\/\/mobidictum.com\/wp-content\/uploads\/2022\/01\/Unity-Lerp-Vector3-380x121.jpg 380w, https:\/\/mobidictum.com\/wp-content\/uploads\/2022\/01\/Unity-Lerp-Vector3-800x256.jpg 800w, https:\/\/mobidictum.com\/wp-content\/uploads\/2022\/01\/Unity-Lerp-Vector3-600x192.jpg 600w\" sizes=\"(max-width: 908px) 100vw, 908px\" \/><\/figure>\n\n\n\n<p>E\u011fer burdaki \u201clerpValue\u201d de\u011fi\u015fkeninin de\u011feriyle oynarsan\u0131z nas\u0131l bir grafikle posizyon de\u011fi\u015ftirece\u011fini g\u00f6rebilirsiniz. \u00d6rne\u011fin de\u011feri 1\u2019e yak\u0131nla\u015ft\u0131rd\u0131\u011f\u0131n\u0131zda veya 1\u2019den b\u00fcy\u00fck yapt\u0131\u011f\u0131n\u0131zda objenizin pozisyonu direkt verdi\u011finiz pozisyona gidecektir ama de\u011feri 0\u2019a yakla\u015ft\u0131rd\u0131k\u00e7a ise yapm\u0131\u015f oldu\u011funuz hareket biraz daha yava\u015flay\u0131p \u201csmooth\u201d diye tabir etti\u011fimiz yumu\u015fak ge\u00e7i\u015fi elde etmi\u015f olucaks\u0131n\u0131z.<\/p>\n\n\n\n<p class=\"is-style-cnvs-paragraph-callout\">Ufak bir ipucu: E\u011fer lerpValue de\u011ferinizi 0.5 yaparsan\u0131z her seferinde kalan yolunun yar\u0131s\u0131n\u0131 alarak yoluna devam edecektir. <\/p>\n\n\n\n<h2 class=\"is-style-default wp-block-heading\"><strong>Mathf.Lerp()<\/strong><\/h2>\n\n\n\n<p>Son bakaca\u011f\u0131m\u0131z fonksiyon olan\u00a0Mathf.Lerp(float a , float b, float t) ise iki float de\u011ferin aras\u0131nda smooth ge\u00e7i\u015f olmas\u0131n\u0131 sa\u011flar. Diyelim ki bizim bir de\u011ferimiz var:a 2 olsun. Bu de\u011fer ve biz bu de\u011feri bir anda de\u011fil de smooth bir \u015fekilde 4 yapmak istiyoruz bunun i\u00e7in ne yapabiliriz diye d\u00fc\u015f\u00fcnd\u00fc\u011f\u00fcn\u00fcz anlarda akl\u0131n\u0131za hemen Mathf.Lerp() gelmeli. \u00d6rne\u011fi hemen a\u015fa\u011f\u0131da g\u00f6rebilirsiniz:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"908\" height=\"474\" src=\"https:\/\/mobidictum.com\/wp-content\/uploads\/2022\/01\/Unity-Lerp-Mathf.jpg\" alt=\"\" class=\"wp-image-25522\" srcset=\"https:\/\/mobidictum.com\/wp-content\/uploads\/2022\/01\/Unity-Lerp-Mathf.jpg 908w, https:\/\/mobidictum.com\/wp-content\/uploads\/2022\/01\/Unity-Lerp-Mathf-300x157.jpg 300w, https:\/\/mobidictum.com\/wp-content\/uploads\/2022\/01\/Unity-Lerp-Mathf-768x401.jpg 768w, https:\/\/mobidictum.com\/wp-content\/uploads\/2022\/01\/Unity-Lerp-Mathf-380x198.jpg 380w, https:\/\/mobidictum.com\/wp-content\/uploads\/2022\/01\/Unity-Lerp-Mathf-800x418.jpg 800w, https:\/\/mobidictum.com\/wp-content\/uploads\/2022\/01\/Unity-Lerp-Mathf-600x313.jpg 600w\" sizes=\"(max-width: 908px) 100vw, 908px\" \/><\/figure>\n\n\n\n<p>Vector3.Lerp() i\u00e7in s\u00f6yledi\u011fimiz lerpValue de\u011fi\u015fkenine hangi de\u011feri verdi\u011finizde neler olaca\u011f\u0131 k\u0131sm\u0131 ayn\u0131 \u015fekilde burda da ge\u00e7erli deneyip Inspector penceresinden siz de g\u00f6rebilirsiniz.<\/p>\n\n\n\n<p>Mobidictum Academy YouTube kanal\u0131m\u0131zda, son d\u00f6nemin pop\u00fcler oyunlar\u0131ndan ATM Rush&#8217;taki Lerp fonksiyonundan da bahsetmi\u015ftik. A\u015fa\u011f\u0131daki videodan izleyebilirsiniz.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe title=\"Unity | Atm Rush oyunundaki Lerp mekani\u011fi nas\u0131l yap\u0131l\u0131r?\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/NzKyaJ8I6jA?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Unity rehberleri serimizin yeni i\u00e7eri\u011finde Lerp fonksiyonunu anlatt\u0131k.<\/p>\n","protected":false},"author":57,"featured_media":25522,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[8875],"tags":[],"class_list":["post-25518","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-akademi"],"acf":[],"_links":{"self":[{"href":"https:\/\/mobidictum.com\/tr\/wp-json\/wp\/v2\/posts\/25518","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mobidictum.com\/tr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mobidictum.com\/tr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mobidictum.com\/tr\/wp-json\/wp\/v2\/users\/57"}],"replies":[{"embeddable":true,"href":"https:\/\/mobidictum.com\/tr\/wp-json\/wp\/v2\/comments?post=25518"}],"version-history":[{"count":1,"href":"https:\/\/mobidictum.com\/tr\/wp-json\/wp\/v2\/posts\/25518\/revisions"}],"predecessor-version":[{"id":152213,"href":"https:\/\/mobidictum.com\/tr\/wp-json\/wp\/v2\/posts\/25518\/revisions\/152213"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/mobidictum.com\/tr\/wp-json\/wp\/v2\/media\/25522"}],"wp:attachment":[{"href":"https:\/\/mobidictum.com\/tr\/wp-json\/wp\/v2\/media?parent=25518"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mobidictum.com\/tr\/wp-json\/wp\/v2\/categories?post=25518"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mobidictum.com\/tr\/wp-json\/wp\/v2\/tags?post=25518"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}