{"id":456213,"date":"2025-04-16T03:00:03","date_gmt":"2025-04-16T03:00:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=456213"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=456213","title":{"rendered":"<span>\u041f\u0438\u0448\u0435\u043c \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u0443\u044e \u0444\u0438\u0437\u0438\u043a\u0443 \u0434\u043b\u044f \u0431\u0440\u0435\u043b\u043a\u043e\u0432 \u0432 Unreal Engine<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/67fec1b0fc0bb4a8163b4e2a\" data-style=\"\" id=\"67fec1b0fc0bb4a8163b4e2a\" width=\"\"><\/div>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u0434\u0435\u043b\u044e\u0441\u044c \u0441\u0432\u043e\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0431\u0440\u0435\u043b\u043a\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 CableComponent.<\/p>\n<p>\u0418\u0434\u0435\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u0443 \u043c\u0435\u043d\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0431\u0440\u0435\u043b\u043a\u043e\u0432 \u0434\u043b\u044f \u043e\u0440\u0443\u0436\u0438\u044f. \u041a\u0430\u043a \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0432 Unreal Engine \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0430\u043a\u0441\u0435\u0441\u0441\u0443\u0430\u0440\u0430. \u0422\u0443\u0442 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u0431\u0440\u0435\u043b\u043a\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u0441\u0442\u043e\u043a\u043e\u0432\u044b\u0439 CableComponent, \u043d\u043e \u043a\u0430\u043a \u0431\u044b \u043d\u0435 \u0442\u0430\u043a:<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/67fec2854c7c3ebada374ac8\" data-style=\"\" id=\"67fec2854c7c3ebada374ac8\" width=\"\"><\/div>\n<p>\u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0432\u0438\u0434\u0435\u0442\u044c, \u0441\u0442\u043e\u043a\u043e\u0432\u044b\u0439 CableComponent \u0438\u043c\u0435\u0435\u0442 \u0431\u0430\u0433, \u0438\u0437-\u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0432\u0435\u0434\u0435\u0442 \u043a \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044e \u0432\u0441\u0435\u0445 \u043f\u0430\u0440\u0442\u0438\u043a\u043b\u043e\u0432 \u043a\u0430\u0431\u0435\u043b\u044f (\u043a\u0430\u0431\u0435\u043b\u044c \u0438\u043c\u0435\u0435\u0442 \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0434\u0432\u0430 \u043f\u0430\u0440\u0442\u0438\u043a\u043b\u0430: \u043d\u0430\u0447\u0430\u043b\u043e \u0438 \u043a\u043e\u043d\u0435\u0446. \u041f\u043e \u0436\u0435\u043b\u0430\u043d\u0438\u044e \u043c\u0435\u0436\u0434\u0443 \u044d\u0442\u0438\u043c\u0438 \u0434\u0432\u0443\u043c\u044f \u043f\u0430\u0440\u0442\u0438\u043a\u043b\u0430\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0432\u043b\u0438\u044f\u0442\u044c \u043d\u0430 \u043a\u0440\u0438\u0432\u0438\u0437\u043d\u0443 \u043a\u0430\u0431\u0435\u043b\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f).<\/p>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0431\u0440\u0435\u043b\u043a\u0438 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u043c\u0435\u043d\u043d\u043e \u0447\u0435\u0440\u0435\u0437 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u043e\u043a\u043e\u0432\u043e\u0433\u043e CableComponent, \u0442\u0430\u043a \u043a\u0430\u043a \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e\u0433\u043e, \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 \u0434\u043b\u044f \u0430\u0442\u0442\u0430\u0447\u0438\u043d\u0433\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043a \u043a\u043e\u043d\u0446\u0443 \u0432\u0435\u0440\u0435\u0432\u043a\u0438, \u0438 \u0440\u0435\u0433\u0443\u043b\u0438\u0440\u043e\u0432\u043a\u0438 \u044d\u0442\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043f\u043e \u0434\u043b\u0438\u043d\u0435 \u043a\u0430\u0431\u0435\u043b\u044f.<\/p>\n<h2>\u041e\u0441\u043d\u043e\u0432\u044b. \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043a\u0430\u0431\u0435\u043b\u044f \u0438 \u043f\u0440\u0430\u0432\u043a\u0430 \u0431\u0430\u0433\u043e\u0432<\/h2>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442-\u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 UMeshComponent (UCableComponent \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u043e\u043c \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430) \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c UBibelotCableComponent:<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/3bd\/bb4\/23a\/3bdbb423a6aed084365be91ba07cbc14.png\" width=\"1157\" height=\"688\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/3bd\/bb4\/23a\/3bdbb423a6aed084365be91ba07cbc14.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/3bd\/bb4\/23a\/3bdbb423a6aed084365be91ba07cbc14.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f, \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0432\u0435\u0441\u044c \u043a\u043e\u0434 \u0441\u0442\u043e\u043a\u043e\u0432\u043e\u0433\u043e UCableComponent \u0432 \u043d\u0430\u0448 \u043d\u043e\u0432\u043e\u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 UBibelotCableComponent.<\/p>\n<p>\u0411\u0430\u0433 \u0441 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0432\u0441\u0435\u0445 \u043f\u0430\u0440\u0442\u0438\u043a\u043b\u043e\u0432 \u043a\u0430\u0431\u0435\u043b\u044f \u043f\u0440\u0438 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0438\u0437-\u0437\u0430 \u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 InitParticles() \u0432 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 OnUpdateTransform():<\/p>\n<pre><code class=\"cpp\">void UBibelotCableComponent::OnUpdateTransform(EUpdateTransformFlags UpdateTransformFlags, ETeleportType Teleport) { Super::OnUpdateTransform(UpdateTransformFlags, Teleport);  InitParticles(); UpdateBounds(); }<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u043e\u0442 \u044d\u0442\u043e\u0433\u043e \u0431\u0430\u0433\u0430 \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u0435\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c OnTransformUpdate() \u043f\u0440\u0438 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 UBibelotCableComponent, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0444\u043b\u0430\u0433\u0430 bWantsOnUpdateTransform \u0432 false:<\/p>\n<pre><code class=\"cpp\">UBibelotCableComponent::UBibelotCableComponent(const FObjectInitializer&amp; ObjectInitializer) : Super(ObjectInitializer) { PrimaryComponentTick.bCanEverTick = true; bTickInEditor = true; bAutoActivate = true;  bAttachStart = true; bAttachEnd = true; CableWidth = 10.f; NumSegments = 10; NumSides = 4; EndLocation = FVector(100.f, 0, 0); CableLength = 100.f; SubstepTime = 0.02f; SolverIterations = 1; TileMaterial = 1.f; CollisionFriction = 0.2f; CableGravityScale = 1.f;  SetCollisionProfileName(UCollisionProfile::PhysicsActor_ProfileName);  bWantsOnUpdateTransform = false; \/\/ \u042d\u0442\u043e\u0433\u043e \u0444\u043b\u0430\u0433\u0430 }<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435, \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043a\u0430\u0431\u0435\u043b\u044f \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0440\u044f\u0434 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0441 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u043c \u0443\u0436\u0435 \u0432 \u0431\u043b\u044e\u043f\u0440\u0438\u043d\u0442\u0430\u0445:<\/p>\n<ol>\n<li>\n<p>\u041f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0438\u0442\u044c Tick Group \u043d\u0430\u0448\u0435\u0433\u043e BibelotCableComponent \u043d\u0430 Post Physics.<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u043f\u0435\u0440\u0442\u0438 Attach End \u0432 false.<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043a\u0430\u0431\u0435\u043b\u044f: <\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d48\/e3a\/654\/d48e3a6543a2723395bab0f3008499f8.png\" width=\"664\" height=\"370\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/d48\/e3a\/654\/d48e3a6543a2723395bab0f3008499f8.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d48\/e3a\/654\/d48e3a6543a2723395bab0f3008499f8.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<\/li>\n<\/ol>\n<p>\u041a\u0430\u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0430\u043a\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u0430\u0431\u0435\u043b\u044f:<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/67fec4ce4c7c3ebada374be8\" data-style=\"\" id=\"67fec4ce4c7c3ebada374be8\" width=\"\"><\/div>\n<p>\u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0432\u0438\u0434\u0435\u0442\u044c, \u0442\u0430\u043a\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0431\u0440\u0435\u043b\u043a\u0430 \u043e\u0447\u0435\u043d\u044c \u0434\u0430\u043b\u0435\u043a\u043e \u043e\u0442 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e, \u043d\u043e \u0441 \u044d\u0442\u0438\u043c \u0445\u043e\u0442\u044f \u0431\u044b \u0443\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c.<\/p>\n<h2>\u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u0438 \u0434\u043b\u044f \u0431\u0440\u0435\u043b\u043a\u0430<\/h2>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043d\u0430\u0448 \u0431\u0440\u0435\u043b\u043e\u043a \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u043a \u043e\u0440\u0443\u0436\u0438\u044e, \u0442\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0435\u0441\u0442\u044c \u0441\u043c\u044b\u0441\u043b \u043f\u0440\u043e\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u044e \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u044d\u0442\u0438\u043c \u043e\u0440\u0443\u0436\u0438\u0435\u043c. \u0422\u043e \u0435\u0441\u0442\u044c \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u044e \u0431\u0440\u0435\u043b\u043a\u0430 \u0441 \u043e\u0434\u043d\u043e\u0439 \u043b\u0438\u0448\u044c \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c\u044e.<\/p>\n<p>\u041a\u043e\u043b\u043b\u0438\u0437\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: \u041f\u043e\u0441\u043b\u0435 \u0432\u0441\u0435\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0446\u0430 \u043a\u0430\u0431\u0435\u043b\u044f (\u043d\u043e \u0434\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 \u0441\u0430\u043c\u043e\u0433\u043e \u043a\u0430\u0431\u0435\u043b\u044f), \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c, \u043f\u0435\u0440\u0435\u0441\u0435\u043a \u043b\u0438 \u043a\u043e\u043d\u0435\u0446 \u044d\u0442\u043e\u0433\u043e \u043a\u0430\u0431\u0435\u043b\u044f \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u0443\u044e \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c. \u0415\u0441\u043b\u0438 \u0436\u0435 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e, \u0442\u043e \u043c\u044b \u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043b\u0443\u0447 \u0438\u0437 \u043a\u043e\u043d\u0446\u0430 \u043a\u0430\u0431\u0435\u043b\u044f \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 \u0438 \u0444\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u043c \u0442\u043e\u0447\u043a\u0443 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f \u043b\u0443\u0447\u0430 \u0438 \u044d\u0442\u043e\u0439 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438. \u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0442\u043e\u0447\u043a\u0430 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f \u043b\u0443\u0447\u0430 \u0438 \u043d\u0430\u0448\u0435\u0439 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u043c \u043a\u043e\u043d\u0446\u043e\u043c \u043a\u0430\u0431\u0435\u043b\u044f.<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5a3\/3ca\/bdb\/5a33cabdbca35d01020bb4e993b6cc8b.gif\" alt=\"\u0414\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\" title=\"\u0414\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\" width=\"944\" height=\"708\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5a3\/3ca\/bdb\/5a33cabdbca35d01020bb4e993b6cc8b.gif 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5a3\/3ca\/bdb\/5a33cabdbca35d01020bb4e993b6cc8b.gif 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0414\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430<\/figcaption><\/div>\n<\/figure>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043a\u043e\u043d\u0435\u0446 \u043a\u0430\u0431\u0435\u043b\u044f \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0439 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 (\u0442\u043e \u0435\u0441\u0442\u044c \u043a\u043e\u043d\u0435\u0446 \u043a\u0430\u0431\u0435\u043b\u044f \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043e\u0442\u0440\u0438\u0441\u0443\u0435\u0442\u0441\u044f \u0432 \u043c\u0435\u0448\u0435 \u043e\u0440\u0443\u0436\u0438\u044f).<\/p>\n<p>\u041a\u043e\u0434 \u043c\u0435\u0442\u043e\u0434\u0430, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0435\u0433\u043e \u0434\u0430\u043d\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c:<\/p>\n<pre><code class=\"cpp\">void UBibelotCableComponent::FixEndParticleLocation() { FVector SurfaceDot = Particles[0].Position + GetOwner()-&gt;GetActorForwardVector() * (PositionWeaponXCheckOffset); float SurfaceValue = GetSurfaceValue(SurfaceDot, SurfaceDot + GetOwner()-&gt;GetActorRightVector(), SurfaceDot + GetOwner()-&gt;GetActorUpVector(), Particles[1].Position); if (SurfaceValue &lt; 0) { auto Plane = UE::Math::TPlane&lt;double&gt;(SurfaceDot, SurfaceDot + GetOwner()-&gt;GetActorRightVector(), SurfaceDot + GetOwner()-&gt;GetActorUpVector()); auto IntersectDot = FMath::LinePlaneIntersection(Particles[1].Position, Particles[1].Position + GetOwner()-&gt;GetActorForwardVector() * 100, Plane); Particles[1].Position = (IntersectDot - Particles[0].Position).GetSafeNormal() * CableLength + Particles[0].Position; Particles[1].OldPosition = Particles[1].Position; } }<\/code><\/pre>\n<p><strong>(*)<\/strong> \u0421\u0435\u0439\u0447\u0430\u0441 PositionWeaponXCheckOffset = 0.5f \u0438 \u0441\u043b\u0443\u0436\u0438\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u0434\u043b\u044f \u0440\u0435\u0433\u0443\u043b\u0438\u0440\u043e\u0432\u043a\u0438 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 \u043e\u0440\u0443\u0436\u0438\u044f (\u0442\u043e \u0435\u0441\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0433\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0442\u044c \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c \u043e\u0440\u0443\u0436\u0438\u044f \u043f\u043e \u043e\u0434\u043d\u043e\u0439 \u043e\u0441\u0438). \u0422\u0430\u043a\u0436\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435\u0433\u043e \u0434\u0432\u0430 \u043f\u0430\u0440\u0442\u0438\u043a\u043b\u0430, \u0442\u043e Particles[0] &#8212; \u043d\u0430\u0447\u0430\u043b\u043e \u043a\u0430\u0431\u0435\u043b\u044f, \u0430 Particles[1] &#8212; \u043a\u043e\u043d\u0435\u0446 \u043a\u0430\u0431\u0435\u043b\u044f.<\/p>\n<p>\u0412\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0432 \u0442\u0438\u043a\u0435, \u043f\u0435\u0440\u0435\u0434 \u0432\u044b\u0437\u043e\u0432\u043e\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 MarkRenderDynamicDataDirty() (\u0440\u0435\u043d\u0434\u0435\u0440 \u043a\u0430\u0431\u0435\u043b\u044f).<\/p>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/67fec6c4fc0bb4a8163b508e\" data-style=\"\" id=\"67fec6c4fc0bb4a8163b508e\" width=\"\"><\/div>\n<p>\u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0432\u0438\u0434\u0435\u0442\u044c, \u043d\u0430\u0448\u0430 \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043d\u043e \u0431\u0435\u0441\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u043d\u044b\u0435 \u043a\u043e\u043b\u0435\u0431\u0430\u043d\u0438\u044f \u043a\u0430\u0431\u0435\u043b\u044f \u043e\u0441\u0442\u0430\u043b\u0438\u0441\u044c.<\/p>\n<h2>\u0423\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043b\u0435\u0431\u0430\u043d\u0438\u0439 \u043c\u0430\u044f\u0442\u043d\u0438\u043a\u0430<\/h2>\n<p>\u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0432\u0438\u0434\u0435\u0442\u044c, \u0441\u0442\u043e\u043a\u043e\u0432\u044b\u0439 \u043a\u0430\u0431\u0435\u043b\u044c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043d\u0435 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u043d\u0443\u0436\u043d\u044b\u0445 \u043d\u0430\u043c \u043a\u043e\u043b\u0435\u0431\u0430\u043d\u0438\u0439. \u0420\u0430\u0441\u0447\u0435\u0442 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u0441\u0442\u043e\u043a\u043e\u0432\u043e\u0433\u043e \u043a\u0430\u0431\u0435\u043b\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442. \u041e\u043d \u043d\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f, \u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0432\u0435\u043a\u0442\u043e\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u043d\u043e\u0432\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u043a\u043e\u043d\u0446\u0430 \u043a\u0430\u0431\u0435\u043b\u044f. \u041c\u044b \u0436\u0435 \u043f\u043e\u0434\u0447\u0438\u043d\u0438\u043c \u043a\u043e\u043b\u0435\u0431\u0430\u043d\u0438\u044f \u043a\u0430\u0431\u0435\u043b\u044f \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f\u043c \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043b\u0435\u0431\u0430\u043d\u0438\u0439 \u043c\u0430\u044f\u0442\u043d\u0438\u043a\u0430 (\u0412\u044b\u043d\u0443\u0436\u0434\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043b\u0435\u0431\u0430\u043d\u0438\u044f &#8212; \u043a\u043e\u043b\u0435\u0431\u0430\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u043f\u043e\u0434 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u044f\u044e\u0449\u0438\u0445\u0441\u044f \u0441\u0438\u043b).<\/p>\n<p>\u0414\u0438\u0444\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043b\u0435\u0431\u0430\u043d\u0438\u0439 \u043c\u0430\u044f\u0442\u043d\u0438\u043a\u0430 \u0438\u043c\u0435\u044e\u0442 \u0432\u0438\u0434:<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/9ca\/d7d\/b11\/9cad7db113c5ab916618bd49ff617fd6.png\" width=\"363\" height=\"137\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/9ca\/d7d\/b11\/9cad7db113c5ab916618bd49ff617fd6.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/9ca\/d7d\/b11\/9cad7db113c5ab916618bd49ff617fd6.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0413\u0434\u0435:<br \/> \u03b8 : \u0443\u0433\u043e\u043b \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f \u043c\u0430\u044f\u0442\u043d\u0438\u043a\u0430<br \/> \u03c9 : \u0443\u0433\u043b\u043e\u0432\u0430\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c<br \/> g : \u0441\u0438\u043b\u0430 \u0433\u0440\u0430\u0432\u0438\u0442\u0430\u0446\u0438\u0438<br \/> R : \u0434\u043b\u0438\u043d\u0430 \u0432\u0435\u0440\u0435\u0432\u043a\u0438<br \/> b : \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0442\u0440\u0435\u043d\u0438\u044f<br \/> m : \u043c\u0430\u0441\u0441\u0430 \u043a\u043e\u043d\u0446\u0430 \u043a\u0430\u0431\u0435\u043b\u044f<br \/> A : \u0430\u043c\u043f\u043b\u0438\u0442\u0443\u0434\u0430 \u043f\u0440\u0438\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u043c\u043e\u0439 \u0441\u0438\u043b\u044b (\u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043d\u0443\u0436\u043d\u043e \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u0438\u043b\u044b \u043a \u043c\u0430\u044f\u0442\u043d\u0438\u043a\u0443)<br \/> t : \u0432\u0440\u0435\u043c\u044f (\u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 DeltaTime)<\/p>\n<p>\u0420\u0435\u0448\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u043e\u0435 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0420\u0443\u043d\u0433\u0435-\u041a\u0443\u0442\u0442\u044b (\u043e\u0434\u0438\u043d \u0438\u0437 \u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0414\u0438\u0444\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u0438\u0444\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430. \u041d\u0430\u0448\u0435 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 (\u0432 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0438\u0434\u0435) \u0438\u043c\u0435\u0435\u0442 \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u043a\u0430\u043a \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0438\u0437 \u0434\u0432\u0443\u0445 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430:<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/bcc\/be3\/241\/bccbe3241519430de743cc1a54f9cc2b.png\" width=\"184\" height=\"69\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/bcc\/be3\/241\/bccbe3241519430de743cc1a54f9cc2b.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/bcc\/be3\/241\/bccbe3241519430de743cc1a54f9cc2b.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0420\u0435\u0448\u0430\u044f \u044d\u0442\u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043f\u043e \u043c\u0435\u0442\u043e\u0434\u0443 \u0420\u0443\u043d\u0433\u0435-\u041a\u0443\u0442\u0442\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c:<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/62d\/781\/24d\/62d78124d1d8c914a6468867ff059b73.png\" width=\"347\" height=\"100\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/62d\/781\/24d\/62d78124d1d8c914a6468867ff059b73.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/62d\/781\/24d\/62d78124d1d8c914a6468867ff059b73.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0413\u0434\u0435:<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b81\/2ac\/98e\/b812ac98eb96abaac36c1a78318f5230.png\" width=\"368\" height=\"323\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/b81\/2ac\/98e\/b812ac98eb96abaac36c1a78318f5230.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b81\/2ac\/98e\/b812ac98eb96abaac36c1a78318f5230.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p><strong>(*)<\/strong> h &#8212; \u0434\u043b\u0438\u043d\u0430 \u0448\u0430\u0433\u0430.<\/p>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432\u0441\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043a\u0430\u0431\u0435\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u0433\u043b\u0430\u0432\u043d\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 VerletIntegrate(). \u0412\u0435\u0441\u044c \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043a\u043e\u0434 \u0446\u0438\u043a\u043b\u0430 \u043e\u0442\u0442\u0443\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c, \u0438 \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439 \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043b\u0435\u0431\u0430\u043d\u0438\u0439:<\/p>\n<p>\u041a\u043e\u0434 \u043c\u0435\u0442\u043e\u0434\u0430 VerletIntegrate() \u043f\u043e\u0441\u043b\u0435 \u0432\u0441\u0435\u0445 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0439:<\/p>\n<pre><code class=\"cpp\">void UBibelotCableComponent::VerletIntegrate(float InSubstepTime, const FVector&amp; Gravity, float DeltaTime) { auto f = [&amp;](float time, float tht, float omega) -&gt; float { return omega; };  auto g = [&amp;](float time, float tht, float omega) -&gt; float { return -(grav \/ R) * sin(tht) - ((FinalB \/ (m * R * R)) * omega) + ((A \/ (m * R * R)) * cos(omega * time)); };  const int32 NumParticles = NumSegments + 1; const float SubstepTimeSqr = InSubstepTime * InSubstepTime;  Particles[0].OldPosition = Particles[0].Position; for (int32 ParticleIdx = 0; ParticleIdx &lt; NumParticles; ParticleIdx++) { FBibelotCableParticle&amp; Particle = Particles[ParticleIdx]; if (Particle.bFree) { \/\/ Update position FVector NewPosition;  if (omg &gt; OmegaLimitMin) { FinalB = OmegaLimitB; }  k1 = h * f(time, theta, omg); l1 = h * g(time, theta, omg); k2 = h * f(time + (0.5 * h), theta + (0.5 * k1), omg + (0.5 * l1)); l2 = h * g(time + (0.5 * h), theta + (0.5 * k1), omg + (0.5 * l1)); k3 = h * f(time + (0.5 * h), theta + (0.5 * k2), omg + (0.5 * l2)); l3 = h * g(time + (0.5 * h), theta + (0.5 * k2), omg + (0.5 * l2)); k4 = h * f(time + h, theta + k3, omg + l3); l4 = h * g(time + h, theta + k3, omg + l3);  theta = theta + (k1 + (2 * k2) + (2 * k3) + k4) \/ 6; omg = omg + (l1 + (2 * l2) + (2 * l3) + l4) \/ 6;  if (theta &gt; 2 * PI) theta = theta - (2 * PI); if (theta &lt; -2 * PI) theta = theta + (2 * PI);  time = time + DeltaTime; A = 0; FinalB = b;  FVector XZVec = FVector{ CableLength * FMath::Cos(theta - PI \/ 2.0f), 0, CableLength * FMath::Sin(theta - PI \/ 2.0f) }; NewPosition = XZVec + Particles[0].Position;  Particle.OldPosition = Particle.Position; Particle.Position = UKismetMathLibrary::VInterpTo(Particle.Position, NewPosition, DeltaTime, InterpToSpeed); } } }<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435:<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/67fec8a8488f69a8080a96e8\" data-style=\"\" id=\"67fec8a8488f69a8080a96e8\" width=\"\"><\/div>\n<p><strong>(*)<\/strong> \u041a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0440\u0430\u0432\u043d\u044b:<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/3ff\/a7d\/b5f\/3ffa7db5fbf96d842ff0920717d8a78a.png\" width=\"654\" height=\"232\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/3ff\/a7d\/b5f\/3ffa7db5fbf96d842ff0920717d8a78a.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/3ff\/a7d\/b5f\/3ffa7db5fbf96d842ff0920717d8a78a.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0432\u0438\u0434\u0435\u0442\u044c, \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u043a\u0430\u0431\u0435\u043b\u044f \u043f\u043e\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u043a\u043e\u043b\u0435\u0431\u0430\u043d\u0438\u044f \u0431\u0440\u0435\u043b\u043a\u0430, \u043d\u043e \u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u044d\u0442\u0438 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0442 \u0432\u0441\u0435\u0433\u0434\u0430 \u0432 \u043e\u0434\u043d\u043e\u0439 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 (\u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u0434\u043e\u043b\u044c \u043e\u0440\u0443\u0436\u0438\u044f).<\/p>\n<h2>\u0420\u0435\u0433\u0443\u043b\u0438\u0440\u043e\u0432\u043a\u0430 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 \u043a\u043e\u043b\u0435\u0431\u0430\u043d\u0438\u0439 \u043c\u0430\u044f\u0442\u043d\u0438\u043a\u0430<\/h2>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/940\/e4c\/824\/940e4c82429c49b6f4bdf883d4613954.gif\" alt=\"\u0420\u0435\u0433\u0443\u043b\u0438\u0440\u043e\u0432\u043a\u0430 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 \u0447\u0435\u0440\u0435\u0437 \u0432\u0435\u043a\u0442\u043e\u0440 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0438\u043b\u044b\" title=\"\u0420\u0435\u0433\u0443\u043b\u0438\u0440\u043e\u0432\u043a\u0430 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 \u0447\u0435\u0440\u0435\u0437 \u0432\u0435\u043a\u0442\u043e\u0440 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0438\u043b\u044b\" width=\"944\" height=\"708\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/940\/e4c\/824\/940e4c82429c49b6f4bdf883d4613954.gif 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/940\/e4c\/824\/940e4c82429c49b6f4bdf883d4613954.gif 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0420\u0435\u0433\u0443\u043b\u0438\u0440\u043e\u0432\u043a\u0430 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 \u0447\u0435\u0440\u0435\u0437 \u0432\u0435\u043a\u0442\u043e\u0440 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0438\u043b\u044b<\/figcaption><\/div>\n<\/figure>\n<p>\u0411\u0443\u0434\u0435\u043c \u0440\u0435\u0433\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c (\u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c) \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c \u043a\u043e\u043b\u0435\u0431\u0430\u043d\u0438\u0439 \u043c\u0430\u044f\u0442\u043d\u0438\u043a\u0430 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u0441\u0438\u043b\u044b, \u043f\u0440\u0438\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u043a\u0430\u0431\u0435\u043b\u044e. \u041f\u0440\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u0441\u0438\u043b\u044b, \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043a \u043d\u043e\u0432\u043e\u043c\u0443.<\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u0432\u0435\u0434\u0435\u043c \u0432\u0435\u043a\u0442\u043e\u0440 FVector GeneralForce, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438 \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u043c \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0438\u043b\u044b, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u043e\u0434\u0447\u0438\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c \u043a\u043e\u043b\u0435\u0431\u0430\u043d\u0438\u044f \u043c\u0430\u044f\u0442\u043d\u0438\u043a\u0430.<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043c\u0435\u0442\u043e\u0434 VerletIntegrate() \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043a\u0443\u0441\u043a\u0438 \u043a\u043e\u0434\u0430:<\/p>\n<p>\u041a\u043e\u0434 \u0437\u0430\u043d\u0443\u043b\u0435\u043d\u0438\u044f \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0438\u043b\u044b:<\/p>\n<pre><code class=\"cpp\">if (FMath::IsNearlyZero(omg)) \/\/ \u0415\u0441\u043b\u0438 \u0443\u0433\u043b\u043e\u0432\u0430\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043c\u0430\u044f\u0442\u043d\u0438\u043a\u0430 \u0431\u043b\u0438\u0437\u043a\u0430 \u043a \u043d\u0443\u043b\u044e { GeneralForce = { 0, 0, 0 }; }<\/code><\/pre>\n<p>\u041a\u043e\u0434 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0438\u043b\u044b \u0438 \u043f\u0440\u0438\u0434\u0430\u043d\u0438\u044f \u0441\u0438\u043b\u044b \u043c\u0430\u044f\u0442\u043d\u0438\u043a\u0443 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u043e\u0440\u0443\u0436\u0438\u044f:<\/p>\n<pre><code class=\"cpp\">Vel = GetOwner()-&gt;GetOwner()-&gt;GetActorLocation() - OldBibelotLoc; if (!Vel.IsNearlyZero()) { VelForce = -Vel.GetSafeNormal(); float FinalOmgVelChange = CachedCharacter-&gt;GetVelocity().IsNearlyZero() ? AVelChangeNoVelocity : AVelChangeVelocity; A += FinalOmgVelChange * Vel.Length(); } GeneralForce = UKismetMathLibrary::VInterpTo(GeneralForce, VelForce, DeltaTime, GeneralForceInterpSpeed);<\/code><\/pre>\n<p><strong>(*)<\/strong> \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 OldBibelotLoc \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u0441\u0430\u043c\u043e\u043c \u043a\u043e\u043d\u0446\u0435 \u0442\u0438\u043a\u0430 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430, \u0438 \u0440\u0430\u0432\u043d\u044f\u0435\u0442\u0441\u044f GetOwner()-&gt;GetOwner()-&gt;GetActorLocation().<\/p>\n<p>\u0418\u0437\u043c\u0435\u043d\u0438\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0432\u0435\u043a\u0442\u043e\u0440\u0430 NewPosition:<\/p>\n<pre><code class=\"cpp\">NewPosition = BackRotateToXAxis(GeneralForce, XZVec) + Particles[0].Position;<\/code><\/pre>\n<p>\u0413\u0434\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f BackRotateToXAxis \u043f\u043e\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442 \u0432\u0435\u043a\u0442\u043e\u0440 XZVec \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0442\u043e\u0442 \u043b\u0435\u0436\u0430\u043b \u0432 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 \u0432\u0435\u043a\u0442\u043e\u0440\u0430 GeneralForce.<\/p>\n<p>\u041a\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 BackRotateToXAxis:<\/p>\n<pre><code class=\"cpp\">FVector UBibelotCableComponent::BackRotateToXAxis(FVector StartAxis, FVector RotVector) { float ZComp = RotVector.Z; RotVector = { RotVector.X, RotVector.Y, 0 }; float Angle = FMath::RadiansToDegrees(FMath::Acos(FVector::DotProduct(FVector{ StartAxis.X, StartAxis.Y, 0 }.GetSafeNormal(), RotVector.GetSafeNormal()))); RotVector = RotVector.RotateAngleAxis(Angle * FMath::Sign(FVector::CrossProduct(RotVector, StartAxis).Z), FVector{ 0, 0, 1 }); RotVector.Z = ZComp;  return RotVector; }<\/code><\/pre>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435:<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/67fecaa6159a09bab05526d8\" data-style=\"\" id=\"67fecaa6159a09bab05526d8\" width=\"\"><\/div>\n<h2>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441 FPS<\/h2>\n<p>\u0427\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0441 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043a\u0430\u0431\u0435\u043b\u044f \u043f\u0440\u0438 \u0440\u0430\u0437\u043d\u043e\u043c FPS, \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0446\u0438\u043a\u043b \u0432 \u043c\u0435\u0442\u043e\u0434 TickComponent():<\/p>\n<pre><code class=\"cpp\">for (int32 i = 0; i &lt; (CableFPS * CableFPS) \/ (1.0f \/ DeltaTime); ++i) { TickBody(1.0f \/ (float)CableFPS); }<\/code><\/pre>\n<p>\u0422\u043e \u0435\u0441\u0442\u044c \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043d\u043e\u0435 \u043a\u043e\u043b-\u0432\u043e \u0442\u0438\u043a\u043e\u0432 (\u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u044f\u0449\u0435\u0435 \u043e\u0442 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e FPS), \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u0438 CableFPS = 60, \u043c\u0435\u0442\u043e\u0434 TickBody() \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u0442\u044c\u0441\u044f 3600 \u0440\u0430\u0437 \u0437\u0430 \u0441\u0435\u043a\u0443\u043d\u0434\u0443. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c CableFPS \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0441\u0430\u043c\u0438, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043c\u0430\u044f\u0442\u043d\u0438\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c).<\/p>\n<p><strong>(*)<\/strong> \u0432 \u043c\u0435\u0442\u043e\u0434 TickBody() \u0432\u044b\u043d\u0435\u0441\u0435\u043d \u0432\u0435\u0441\u044c \u043a\u043e\u0434 \u0442\u0438\u043a\u0430.<\/p>\n<h2>\u041a\u043e\u0441\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f<\/h2>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043a\u0440\u0435\u043f\u043b\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0431\u0440\u0435\u043b\u043a\u0430 (\u043a\u0430\u0431\u0435\u043b\u044f), \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0438\u0437 \u0434\u0432\u0443\u0445 \u043c\u0435\u0448\u0435\u0439:<\/p>\n<ol>\n<li>\n<p>\u041a\u0440\u0435\u043f\u043b\u0435\u043d\u0438\u0435 \u043a \u0441\u0430\u043c\u043e\u043c\u0443 \u043e\u0440\u0443\u0436\u0438\u044e (\u043c\u043e\u0436\u0435\u0442 \u0432\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 Forward \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u043e\u0440\u0443\u0436\u0438\u044f).<\/p>\n<\/li>\n<li>\n<p>\u041a\u0440\u0435\u043f\u043b\u0435\u043d\u0438\u0435 \u043a \u0431\u0440\u0435\u043b\u043a\u0443 (\u041a\u0440\u0435\u043f\u0438\u0442\u0441\u044f \u043a \u043f\u0435\u0440\u0432\u043e\u043c\u0443 \u043c\u0435\u0448\u0443, \u0438 \u043c\u043e\u0436\u0435\u0442 \u0432\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 Right \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u043e\u0440\u0443\u0436\u0438\u044f). \u0421\u0430\u043c \u0436\u0435 \u043a\u0430\u0431\u0435\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u043a\u0440\u0435\u043f\u0438\u0442\u044c\u0441\u044f \u043a\u043e \u0432\u0442\u043e\u0440\u043e\u043c\u0443 \u043c\u0435\u0448\u0443.<\/p>\n<\/li>\n<\/ol>\n<p>Pivot \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043c\u0435\u0448\u0430 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 Left \u0447\u0430\u0441\u0442\u0438 \u043c\u0435\u0448\u0430, \u0430 Pivot \u0434\u043b\u044f \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u0435\u0448\u0430 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 Top \u0447\u0430\u0441\u0442\u0438 \u0441\u0432\u043e\u0435\u0433\u043e \u043c\u0435\u0448\u0430 (\u043e\u043f\u044f\u0442\u044c \u0436\u0435 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u043c\u0435\u0448\u0435\u0439 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u0438\u0432\u043e\u0442\u043e\u0432).<\/p>\n<p><strong>(*)<\/strong> Pivot &#8212; \u043e\u043f\u043e\u0440\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0435\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043c\u0435\u0448\u0435\u0439<\/p>\n<p>\u0412\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0448\u0435\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u0432 \u0442\u0438\u043a\u0435 \u0431\u043b\u044e\u043f\u0440\u0438\u043d\u0442\u0430 \u0431\u0440\u0435\u043b\u043a\u0430, \u0438 \u0437\u0430\u0432\u0438\u0441\u0435\u0442\u044c \u043e\u0442 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0439 \u0441\u0430\u043c\u043e\u0433\u043e \u043a\u0430\u0431\u0435\u043b\u044f.<\/p>\n<p>\u041a\u043e\u0434 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043c\u0435\u0448\u0430:<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/428\/e38\/4ea\/428e384ea5db343c294e4487d778b6a5.png\" width=\"1024\" height=\"632\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/428\/e38\/4ea\/428e384ea5db343c294e4487d778b6a5.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/428\/e38\/4ea\/428e384ea5db343c294e4487d778b6a5.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u041a\u043e\u0434 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u0435\u0448\u0430:<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/46a\/e02\/99c\/46ae0299ce5bccb91c2385d9178671a6.png\" width=\"1202\" height=\"592\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/46a\/e02\/99c\/46ae0299ce5bccb91c2385d9178671a6.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/46a\/e02\/99c\/46ae0299ce5bccb91c2385d9178671a6.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0413\u0434\u0435 \u043c\u0435\u0442\u043e\u0434 GetXZCableRotation() \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 FRotator \u043a\u0430\u0431\u0435\u043b\u044f \u0432 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 XZ:<\/p>\n<pre><code class=\"cpp\">FRotator UBibelotCableComponent::GetXZCableRotation() { return UKismetMathLibrary::FindLookAtRotation({ 0, 0, 0 }, RotateToXAxis(Particles[1].Position - Particles[0].Position)); }<\/code><\/pre>\n<p><strong>(*)<\/strong> \u0424\u0443\u043d\u043a\u0446\u0438\u044f RotateToXAxis() &#8212; \u044d\u0442\u043e \u043e\u0431\u0440\u0430\u0442\u043d\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 BackRotateToXAxis(). \u0422\u043e \u0435\u0441\u0442\u044c, \u0435\u0441\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f BackRotateToXAxis() \u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0432\u0435\u043a\u0442\u043e\u0440 \u0438\u0437 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 XZ \u0432 \u0434\u0440\u0443\u0433\u0443\u044e \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c, \u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f RotateToXAxis() \u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0432\u0435\u043a\u0442\u043e\u0440 \u0438\u0437 \u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 \u0432 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c XZ:<\/p>\n<pre><code class=\"cpp\">FVector UBibelotCableComponent::RotateToXAxis(FVector RotVector) { float ZComp = RotVector.Z; RotVector = { RotVector.X, RotVector.Y, 0 }; float Angle = FMath::RadiansToDegrees(FMath::Acos(FVector::DotProduct({ 1, 0, 0 }, RotVector.GetSafeNormal()))); RotVector = RotVector.RotateAngleAxis(Angle * FMath::Sign(FVector::CrossProduct(RotVector, { 1, 0, 0 }).Z), FVector{ 0, 0, 1 }); RotVector.Z = ZComp;  return RotVector; }<\/code><\/pre>\n<h2>\u0423\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0435 \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u0438 \u0431\u0440\u0435\u043b\u043a\u0430<\/h2>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u043a\u0440\u0435\u043f\u0438\u043c \u0431\u0440\u0435\u043b\u043e\u043a \u043a\u043e \u0432\u0442\u043e\u0440\u043e\u043c\u0443 \u043c\u0435\u0448\u0443 (\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u0432\u0438\u0436\u0438\u0442\u0441\u044f), \u0442\u043e \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0438 \u043d\u0430\u0447\u0430\u043b\u043e \u043a\u0430\u0431\u0435\u043b\u044f \u0442\u0430\u043a \u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0442\u044c\u0441\u044f. \u0410 \u0442\u0430\u043a \u043a\u0430\u043a \u0441\u0435\u0439\u0447\u0430\u0441 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 \u043e\u0440\u0443\u0436\u0438\u044f \u0434\u043b\u044f \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043b\u043e\u043a\u0430\u0446\u0438\u0438 \u043d\u0430\u0447\u0430\u043b\u0430 \u043a\u0430\u0431\u0435\u043b\u044f (Particles[0].Position), \u0442\u043e \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0435 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e.<\/p>\n<p>\u0422\u043e \u0435\u0441\u0442\u044c \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c \u043e\u0440\u0443\u0436\u0438\u044f \u0434\u043b\u044f \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u0438 \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430\u0447\u0430\u043b\u0430 \u043a\u0430\u0431\u0435\u043b\u044f, \u0430 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043c\u0435\u0448\u0430 (\u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u043d\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f):<\/p>\n<pre><code class=\"cpp\">void UBibelotCableComponent::FixEndParticleLocation() { auto BibelotMesh = GetOwner()-&gt;FindComponentByTag&lt;UStaticMeshComponent&gt;(\"BibelotMesh\"); FVector SocketLoc1 = BibelotMesh-&gt;GetSocketLocation(\"ScaleSocket1\"); FVector SocketLoc2 = BibelotMesh-&gt;GetSocketLocation(\"ScaleSocket2\");  auto BibelotFixasion = GetOwner()-&gt;FindComponentByTag&lt;UStaticMeshComponent&gt;(\"BibelotFixation1\"); float PositionWeaponXCheckOffset = (SocketLoc1 - SocketLoc2).Length();  float AdvancedWeaponXOffset = abs(BibelotFixasion-&gt;GetSocketLocation(\"BibelotFixationSocket\").X - Particles[0].Position.X); FVector SurfaceDot = Particles[0].Position + GetOwner()-&gt;GetActorForwardVector() * (PositionWeaponXCheckOffset - AdvancedWeaponXOffset); float SurfaceValue = GetSurfaceValue(SurfaceDot, SurfaceDot + GetOwner()-&gt;GetActorRightVector(), SurfaceDot + GetOwner()-&gt;GetActorUpVector(), Particles[1].Position); if (SurfaceValue &lt; 0) { auto Plane = UE::Math::TPlane&lt;double&gt;(SurfaceDot, SurfaceDot + GetOwner()-&gt;GetActorRightVector(), SurfaceDot + GetOwner()-&gt;GetActorUpVector()); auto IntersectDot = FMath::LinePlaneIntersection(Particles[1].Position, Particles[1].Position + GetOwner()-&gt;GetActorForwardVector() * 100, Plane); Particles[1].Position = (IntersectDot - Particles[0].Position).GetSafeNormal() * CableLength + Particles[0].Position; Particles[1].OldPosition = Particles[1].Position; } }<\/code><\/pre>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0441 \u0442\u0435\u0433\u043e\u043c &#171;BibelotFixation1&#187; \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u044b\u043c \u043c\u0435\u0448\u0435\u043c (&#171;BibelotFixationSocket&#187; &#8212; \u0441\u043e\u043a\u0435\u0442, \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 \u043e\u0440\u0443\u0436\u0438\u044f); \u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0441 \u0442\u0435\u0433\u043e\u043c &#171;BibelotMesh&#187; \u0435\u0441\u0442\u044c \u043c\u0435\u0448, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043a\u0440\u0435\u043f\u0438\u0442\u0441\u044f \u043a \u043a\u043e\u043d\u0446\u0443 \u043a\u0430\u0431\u0435\u043b\u044f (&#171;ScaleSocket1&#187; &#8212; \u0446\u0435\u043d\u0442\u0440 \u043c\u0435\u0448\u0430, &#171;ScaleSocket2&#187; &#8212; \u043a\u043e\u043d\u0435\u0446 \u043c\u0435\u0448\u0430).<\/p>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u043a\u043b\u0430\u0441\u0441\u0430 UBibelotCableComponent \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0437\u0434\u0435\u0441\u044c:<\/p>\n<p><a href=\"https:\/\/github.com\/JohnMega\/BibelotCableComponent\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/JohnMega\/BibelotCableComponent<\/a><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/901188\/\"> https:\/\/habr.com\/ru\/articles\/901188\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/67fec1b0fc0bb4a8163b4e2a\" data-style=\"\" id=\"67fec1b0fc0bb4a8163b4e2a\" width=\"\"><\/div>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u0434\u0435\u043b\u044e\u0441\u044c \u0441\u0432\u043e\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0431\u0440\u0435\u043b\u043a\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 CableComponent.<\/p>\n<p>\u0418\u0434\u0435\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u0443 \u043c\u0435\u043d\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0431\u0440\u0435\u043b\u043a\u043e\u0432 \u0434\u043b\u044f \u043e\u0440\u0443\u0436\u0438\u044f. \u041a\u0430\u043a \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0432 Unreal Engine \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0430\u043a\u0441\u0435\u0441\u0441\u0443\u0430\u0440\u0430. \u0422\u0443\u0442 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u0431\u0440\u0435\u043b\u043a\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u0441\u0442\u043e\u043a\u043e\u0432\u044b\u0439 CableComponent, \u043d\u043e \u043a\u0430\u043a \u0431\u044b \u043d\u0435 \u0442\u0430\u043a:<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/67fec2854c7c3ebada374ac8\" data-style=\"\" id=\"67fec2854c7c3ebada374ac8\" width=\"\"><\/div>\n<p>\u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0432\u0438\u0434\u0435\u0442\u044c, \u0441\u0442\u043e\u043a\u043e\u0432\u044b\u0439 CableComponent \u0438\u043c\u0435\u0435\u0442 \u0431\u0430\u0433, \u0438\u0437-\u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0432\u0435\u0434\u0435\u0442 \u043a \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044e \u0432\u0441\u0435\u0445 \u043f\u0430\u0440\u0442\u0438\u043a\u043b\u043e\u0432 \u043a\u0430\u0431\u0435\u043b\u044f (\u043a\u0430\u0431\u0435\u043b\u044c \u0438\u043c\u0435\u0435\u0442 \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0434\u0432\u0430 \u043f\u0430\u0440\u0442\u0438\u043a\u043b\u0430: \u043d\u0430\u0447\u0430\u043b\u043e \u0438 \u043a\u043e\u043d\u0435\u0446. \u041f\u043e \u0436\u0435\u043b\u0430\u043d\u0438\u044e \u043c\u0435\u0436\u0434\u0443 \u044d\u0442\u0438\u043c\u0438 \u0434\u0432\u0443\u043c\u044f \u043f\u0430\u0440\u0442\u0438\u043a\u043b\u0430\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0432\u043b\u0438\u044f\u0442\u044c \u043d\u0430 \u043a\u0440\u0438\u0432\u0438\u0437\u043d\u0443 \u043a\u0430\u0431\u0435\u043b\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f).<\/p>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0431\u0440\u0435\u043b\u043a\u0438 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u043c\u0435\u043d\u043d\u043e \u0447\u0435\u0440\u0435\u0437 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u043e\u043a\u043e\u0432\u043e\u0433\u043e CableComponent, \u0442\u0430\u043a \u043a\u0430\u043a \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e\u0433\u043e, \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 \u0434\u043b\u044f \u0430\u0442\u0442\u0430\u0447\u0438\u043d\u0433\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043a \u043a\u043e\u043d\u0446\u0443 \u0432\u0435\u0440\u0435\u0432\u043a\u0438, \u0438 \u0440\u0435\u0433\u0443\u043b\u0438\u0440\u043e\u0432\u043a\u0438 \u044d\u0442\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043f\u043e \u0434\u043b\u0438\u043d\u0435 \u043a\u0430\u0431\u0435\u043b\u044f.<\/p>\n<h2>\u041e\u0441\u043d\u043e\u0432\u044b. \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043a\u0430\u0431\u0435\u043b\u044f \u0438 \u043f\u0440\u0430\u0432\u043a\u0430 \u0431\u0430\u0433\u043e\u0432<\/h2>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442-\u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 UMeshComponent (UCableComponent \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u043e\u043c \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430) \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c UBibelotCableComponent:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f, \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0432\u0435\u0441\u044c \u043a\u043e\u0434 \u0441\u0442\u043e\u043a\u043e\u0432\u043e\u0433\u043e UCableComponent \u0432 \u043d\u0430\u0448 \u043d\u043e\u0432\u043e\u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 UBibelotCableComponent.<\/p>\n<p>\u0411\u0430\u0433 \u0441 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0432\u0441\u0435\u0445 \u043f\u0430\u0440\u0442\u0438\u043a\u043b\u043e\u0432 \u043a\u0430\u0431\u0435\u043b\u044f \u043f\u0440\u0438 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0438\u0437-\u0437\u0430 \u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 InitParticles() \u0432 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 OnUpdateTransform():<\/p>\n<pre><code class=\"cpp\">void UBibelotCableComponent::OnUpdateTransform(EUpdateTransformFlags UpdateTransformFlags, ETeleportType Teleport) { Super::OnUpdateTransform(UpdateTransformFlags, Teleport);  InitParticles(); UpdateBounds(); }<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u043e\u0442 \u044d\u0442\u043e\u0433\u043e \u0431\u0430\u0433\u0430 \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u0435\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c OnTransformUpdate() \u043f\u0440\u0438 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 UBibelotCableComponent, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0444\u043b\u0430\u0433\u0430 bWantsOnUpdateTransform \u0432 false:<\/p>\n<pre><code class=\"cpp\">UBibelotCableComponent::UBibelotCableComponent(const FObjectInitializer&amp; ObjectInitializer) : Super(ObjectInitializer) { PrimaryComponentTick.bCanEverTick = true; bTickInEditor = true; bAutoActivate = true;  bAttachStart = true; bAttachEnd = true; CableWidth = 10.f; NumSegments = 10; NumSides = 4; EndLocation = FVector(100.f, 0, 0); CableLength = 100.f; SubstepTime = 0.02f; SolverIterations = 1; TileMaterial = 1.f; CollisionFriction = 0.2f; CableGravityScale = 1.f;  SetCollisionProfileName(UCollisionProfile::PhysicsActor_ProfileName);  bWantsOnUpdateTransform = false; \/\/ \u042d\u0442\u043e\u0433\u043e \u0444\u043b\u0430\u0433\u0430 }<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435, \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043a\u0430\u0431\u0435\u043b\u044f \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0440\u044f\u0434 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0441 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u043c \u0443\u0436\u0435 \u0432 \u0431\u043b\u044e\u043f\u0440\u0438\u043d\u0442\u0430\u0445:<\/p>\n<ol>\n<li>\n<p>\u041f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0438\u0442\u044c Tick Group \u043d\u0430\u0448\u0435\u0433\u043e BibelotCableComponent \u043d\u0430 Post Physics.<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u043f\u0435\u0440\u0442\u0438 Attach End \u0432 false.<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043a\u0430\u0431\u0435\u043b\u044f: <\/p>\n<figure class=\"full-width\"><\/figure>\n<\/li>\n<\/ol>\n<p>\u041a\u0430\u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0430\u043a\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u0430\u0431\u0435\u043b\u044f:<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/67fec4ce4c7c3ebada374be8\" data-style=\"\" id=\"67fec4ce4c7c3ebada374be8\" width=\"\"><\/div>\n<p>\u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0432\u0438\u0434\u0435\u0442\u044c, \u0442\u0430\u043a\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0431\u0440\u0435\u043b\u043a\u0430 \u043e\u0447\u0435\u043d\u044c \u0434\u0430\u043b\u0435\u043a\u043e \u043e\u0442 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e, \u043d\u043e \u0441 \u044d\u0442\u0438\u043c \u0445\u043e\u0442\u044f \u0431\u044b \u0443\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c.<\/p>\n<h2>\u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u0438 \u0434\u043b\u044f \u0431\u0440\u0435\u043b\u043a\u0430<\/h2>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043d\u0430\u0448 \u0431\u0440\u0435\u043b\u043e\u043a \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u043a \u043e\u0440\u0443\u0436\u0438\u044e, \u0442\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0435\u0441\u0442\u044c \u0441\u043c\u044b\u0441\u043b \u043f\u0440\u043e\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u044e \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u044d\u0442\u0438\u043c \u043e\u0440\u0443\u0436\u0438\u0435\u043c. \u0422\u043e \u0435\u0441\u0442\u044c \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u044e \u0431\u0440\u0435\u043b\u043a\u0430 \u0441 \u043e\u0434\u043d\u043e\u0439 \u043b\u0438\u0448\u044c \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c\u044e.<\/p>\n<p>\u041a\u043e\u043b\u043b\u0438\u0437\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: \u041f\u043e\u0441\u043b\u0435 \u0432\u0441\u0435\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0446\u0430 \u043a\u0430\u0431\u0435\u043b\u044f (\u043d\u043e \u0434\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 \u0441\u0430\u043c\u043e\u0433\u043e \u043a\u0430\u0431\u0435\u043b\u044f), \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c, \u043f\u0435\u0440\u0435\u0441\u0435\u043a \u043b\u0438 \u043a\u043e\u043d\u0435\u0446 \u044d\u0442\u043e\u0433\u043e \u043a\u0430\u0431\u0435\u043b\u044f \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u0443\u044e \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c. \u0415\u0441\u043b\u0438 \u0436\u0435 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e, \u0442\u043e \u043c\u044b \u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043b\u0443\u0447 \u0438\u0437 \u043a\u043e\u043d\u0446\u0430 \u043a\u0430\u0431\u0435\u043b\u044f \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 \u0438 \u0444\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u043c \u0442\u043e\u0447\u043a\u0443 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f \u043b\u0443\u0447\u0430 \u0438 \u044d\u0442\u043e\u0439 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438. \u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0442\u043e\u0447\u043a\u0430 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f \u043b\u0443\u0447\u0430 \u0438 \u043d\u0430\u0448\u0435\u0439 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u043c \u043a\u043e\u043d\u0446\u043e\u043c \u043a\u0430\u0431\u0435\u043b\u044f.<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0414\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430<\/figcaption><\/div>\n<\/figure>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043a\u043e\u043d\u0435\u0446 \u043a\u0430\u0431\u0435\u043b\u044f \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0439 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 (\u0442\u043e \u0435\u0441\u0442\u044c \u043a\u043e\u043d\u0435\u0446 \u043a\u0430\u0431\u0435\u043b\u044f \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043e\u0442\u0440\u0438\u0441\u0443\u0435\u0442\u0441\u044f \u0432 \u043c\u0435\u0448\u0435 \u043e\u0440\u0443\u0436\u0438\u044f).<\/p>\n<p>\u041a\u043e\u0434 \u043c\u0435\u0442\u043e\u0434\u0430, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0435\u0433\u043e \u0434\u0430\u043d\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c:<\/p>\n<pre><code class=\"cpp\">void UBibelotCableComponent::FixEndParticleLocation() { FVector SurfaceDot = Particles[0].Position + GetOwner()-&gt;GetActorForwardVector() * (PositionWeaponXCheckOffset); float SurfaceValue = GetSurfaceValue(SurfaceDot, SurfaceDot + GetOwner()-&gt;GetActorRightVector(), SurfaceDot + GetOwner()-&gt;GetActorUpVector(), Particles[1].Position); if (SurfaceValue &lt; 0) { auto Plane = UE::Math::TPlane&lt;double&gt;(SurfaceDot, SurfaceDot + GetOwner()-&gt;GetActorRightVector(), SurfaceDot + GetOwner()-&gt;GetActorUpVector()); auto IntersectDot = FMath::LinePlaneIntersection(Particles[1].Position, Particles[1].Position + GetOwner()-&gt;GetActorForwardVector() * 100, Plane); Particles[1].Position = (IntersectDot - Particles[0].Position).GetSafeNormal() * CableLength + Particles[0].Position; Particles[1].OldPosition = Particles[1].Position; } }<\/code><\/pre>\n<p><strong>(*)<\/strong> \u0421\u0435\u0439\u0447\u0430\u0441 PositionWeaponXCheckOffset = 0.5f \u0438 \u0441\u043b\u0443\u0436\u0438\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u0434\u043b\u044f \u0440\u0435\u0433\u0443\u043b\u0438\u0440\u043e\u0432\u043a\u0438 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 \u043e\u0440\u0443\u0436\u0438\u044f (\u0442\u043e \u0435\u0441\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0433\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0442\u044c \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c \u043e\u0440\u0443\u0436\u0438\u044f \u043f\u043e \u043e\u0434\u043d\u043e\u0439 \u043e\u0441\u0438). \u0422\u0430\u043a\u0436\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435\u0433\u043e \u0434\u0432\u0430 \u043f\u0430\u0440\u0442\u0438\u043a\u043b\u0430, \u0442\u043e Particles[0] &#8212; \u043d\u0430\u0447\u0430\u043b\u043e \u043a\u0430\u0431\u0435\u043b\u044f, \u0430 Particles[1] &#8212; \u043a\u043e\u043d\u0435\u0446 \u043a\u0430\u0431\u0435\u043b\u044f.<\/p>\n<p>\u0412\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0432 \u0442\u0438\u043a\u0435, \u043f\u0435\u0440\u0435\u0434 \u0432\u044b\u0437\u043e\u0432\u043e\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 MarkRenderDynamicDataDirty() (\u0440\u0435\u043d\u0434\u0435\u0440 \u043a\u0430\u0431\u0435\u043b\u044f).<\/p>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/67fec6c4fc0bb4a8163b508e\" data-style=\"\" id=\"67fec6c4fc0bb4a8163b508e\" width=\"\"><\/div>\n<p>\u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0432\u0438\u0434\u0435\u0442\u044c, \u043d\u0430\u0448\u0430 \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043d\u043e \u0431\u0435\u0441\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u043d\u044b\u0435 \u043a\u043e\u043b\u0435\u0431\u0430\u043d\u0438\u044f \u043a\u0430\u0431\u0435\u043b\u044f \u043e\u0441\u0442\u0430\u043b\u0438\u0441\u044c.<\/p>\n<h2>\u0423\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043b\u0435\u0431\u0430\u043d\u0438\u0439 \u043c\u0430\u044f\u0442\u043d\u0438\u043a\u0430<\/h2>\n<p>\u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0432\u0438\u0434\u0435\u0442\u044c, \u0441\u0442\u043e\u043a\u043e\u0432\u044b\u0439 \u043a\u0430\u0431\u0435\u043b\u044c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043d\u0435 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u043d\u0443\u0436\u043d\u044b\u0445 \u043d\u0430\u043c \u043a\u043e\u043b\u0435\u0431\u0430\u043d\u0438\u0439. \u0420\u0430\u0441\u0447\u0435\u0442 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u0441\u0442\u043e\u043a\u043e\u0432\u043e\u0433\u043e \u043a\u0430\u0431\u0435\u043b\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442. \u041e\u043d \u043d\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f, \u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0432\u0435\u043a\u0442\u043e\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u043d\u043e\u0432\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u043a\u043e\u043d\u0446\u0430 \u043a\u0430\u0431\u0435\u043b\u044f. \u041c\u044b \u0436\u0435 \u043f\u043e\u0434\u0447\u0438\u043d\u0438\u043c \u043a\u043e\u043b\u0435\u0431\u0430\u043d\u0438\u044f \u043a\u0430\u0431\u0435\u043b\u044f \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f\u043c \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043b\u0435\u0431\u0430\u043d\u0438\u0439 \u043c\u0430\u044f\u0442\u043d\u0438\u043a\u0430 (\u0412\u044b\u043d\u0443\u0436\u0434\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043b\u0435\u0431\u0430\u043d\u0438\u044f &#8212; \u043a\u043e\u043b\u0435\u0431\u0430\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u043f\u043e\u0434 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u044f\u044e\u0449\u0438\u0445\u0441\u044f \u0441\u0438\u043b).<\/p>\n<p>\u0414\u0438\u0444\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043b\u0435\u0431\u0430\u043d\u0438\u0439 \u043c\u0430\u044f\u0442\u043d\u0438\u043a\u0430 \u0438\u043c\u0435\u044e\u0442 \u0432\u0438\u0434:<\/p>\n<figure class=\"\"><\/figure>\n<p>\u0413\u0434\u0435:<br \/> \u03b8 : \u0443\u0433\u043e\u043b \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f \u043c\u0430\u044f\u0442\u043d\u0438\u043a\u0430<br \/> \u03c9 : \u0443\u0433\u043b\u043e\u0432\u0430\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c<br \/> g : \u0441\u0438\u043b\u0430 \u0433\u0440\u0430\u0432\u0438\u0442\u0430\u0446\u0438\u0438<br \/> R : \u0434\u043b\u0438\u043d\u0430 \u0432\u0435\u0440\u0435\u0432\u043a\u0438<br \/> b : \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0442\u0440\u0435\u043d\u0438\u044f<br \/> m : \u043c\u0430\u0441\u0441\u0430 \u043a\u043e\u043d\u0446\u0430 \u043a\u0430\u0431\u0435\u043b\u044f<br \/> A : \u0430\u043c\u043f\u043b\u0438\u0442\u0443\u0434\u0430 \u043f\u0440\u0438\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u043c\u043e\u0439 \u0441\u0438\u043b\u044b (\u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043d\u0443\u0436\u043d\u043e \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u0438\u043b\u044b \u043a \u043c\u0430\u044f\u0442\u043d\u0438\u043a\u0443)<br \/> t : \u0432\u0440\u0435\u043c\u044f (\u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 DeltaTime)<\/p>\n<p>\u0420\u0435\u0448\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u043e\u0435 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0420\u0443\u043d\u0433\u0435-\u041a\u0443\u0442\u0442\u044b (\u043e\u0434\u0438\u043d \u0438\u0437 \u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0414\u0438\u0444\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u0438\u0444\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430. \u041d\u0430\u0448\u0435 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 (\u0432 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0438\u0434\u0435) \u0438\u043c\u0435\u0435\u0442 \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u043a\u0430\u043a \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0438\u0437 \u0434\u0432\u0443\u0445 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430:<\/p>\n<figure class=\"\"><\/figure>\n<p>\u0420\u0435\u0448\u0430\u044f \u044d\u0442\u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043f\u043e \u043c\u0435\u0442\u043e\u0434\u0443 \u0420\u0443\u043d\u0433\u0435-\u041a\u0443\u0442\u0442\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c:<\/p>\n<figure class=\"\"><\/figure>\n<p>\u0413\u0434\u0435:<\/p>\n<figure class=\"\"><\/figure>\n<p><strong>(*)<\/strong> h &#8212; \u0434\u043b\u0438\u043d\u0430 \u0448\u0430\u0433\u0430.<\/p>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432\u0441\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043a\u0430\u0431\u0435\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u0433\u043b\u0430\u0432\u043d\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 VerletIntegrate(). \u0412\u0435\u0441\u044c \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043a\u043e\u0434 \u0446\u0438\u043a\u043b\u0430 \u043e\u0442\u0442\u0443\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c, \u0438 \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439 \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043b\u0435\u0431\u0430\u043d\u0438\u0439:<\/p>\n<p>\u041a\u043e\u0434 \u043c\u0435\u0442\u043e\u0434\u0430 VerletIntegrate() \u043f\u043e\u0441\u043b\u0435 \u0432\u0441\u0435\u0445 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0439:<\/p>\n<pre><code class=\"cpp\">void UBibelotCableComponent::VerletIntegrate(float InSubstepTime, const FVector&amp; Gravity, float DeltaTime) { auto f = [&amp;](float time, float tht, float omega) -&gt; float { return omega; };  auto g = [&amp;](float time, float tht, float omega) -&gt; float { return -(grav \/ R) * sin(tht) - ((FinalB \/ (m * R * R)) * omega) + ((A \/ (m * R * R)) * cos(omega * time)); };  const int32 NumParticles = NumSegments + 1; const float SubstepTimeSqr = InSubstepTime * InSubstepTime;  Particles[0].OldPosition = Particles[0].Position; for (int32 ParticleIdx = 0; ParticleIdx &lt; NumParticles; ParticleIdx++) { FBibelotCableParticle&amp; Particle = Particles[ParticleIdx]; if (Particle.bFree) { \/\/ Update position FVector NewPosition;  if (omg &gt; OmegaLimitMin) { FinalB = OmegaLimitB; }  k1 = h * f(time, theta, omg); l1 = h * g(time, theta, omg); k2 = h * f(time + (0.5 * h), theta + (0.5 * k1), omg + (0.5 * l1)); l2 = h * g(time + (0.5 * h), theta + (0.5 * k1), omg + (0.5 * l1)); k3 = h * f(time + (0.5 * h), theta + (0.5 * k2), omg + (0.5 * l2)); l3 = h * g(time + (0.5 * h), theta + (0.5 * k2), omg + (0.5 * l2)); k4 = h * f(time + h, theta + k3, omg + l3); l4 = h * g(time + h, theta + k3, omg + l3);  theta = theta + (k1 + (2 * k2) + (2 * k3) + k4) \/ 6; omg = omg + (l1 + (2 * l2) + (2 * l3) + l4) \/ 6;  if (theta &gt; 2 * PI) theta = theta - (2 * PI); if (theta &lt; -2 * PI) theta = theta + (2 * PI);  time = time + DeltaTime; A = 0; FinalB = b;  FVector XZVec = FVector{ CableLength * FMath::Cos(theta - PI \/ 2.0f), 0, CableLength * FMath::Sin(theta - PI \/ 2.0f) }; NewPosition = XZVec + Particles[0].Position;  Particle.OldPosition = Particle.Position; Particle.Position = UKismetMathLibrary::VInterpTo(Particle.Position, NewPosition, DeltaTime, InterpToSpeed); } } }<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435:<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/67fec8a8488f69a8080a96e8\" data-style=\"\" id=\"67fec8a8488f69a8080a96e8\" width=\"\"><\/div>\n<p><strong>(*)<\/strong> \u041a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0440\u0430\u0432\u043d\u044b:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0432\u0438\u0434\u0435\u0442\u044c, \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u043a\u0430\u0431\u0435\u043b\u044f \u043f\u043e\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u043a\u043e\u043b\u0435\u0431\u0430\u043d\u0438\u044f \u0431\u0440\u0435\u043b\u043a\u0430, \u043d\u043e \u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u044d\u0442\u0438 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0442 \u0432\u0441\u0435\u0433\u0434\u0430 \u0432 \u043e\u0434\u043d\u043e\u0439 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 (\u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u0434\u043e\u043b\u044c \u043e\u0440\u0443\u0436\u0438\u044f).<\/p>\n<h2>\u0420\u0435\u0433\u0443\u043b\u0438\u0440\u043e\u0432\u043a\u0430 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 \u043a\u043e\u043b\u0435\u0431\u0430\u043d\u0438\u0439 \u043c\u0430\u044f\u0442\u043d\u0438\u043a\u0430<\/h2>\n<figure class=\"full-width\">\n<div><figcaption>\u0420\u0435\u0433\u0443\u043b\u0438\u0440\u043e\u0432\u043a\u0430 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 \u0447\u0435\u0440\u0435\u0437 \u0432\u0435\u043a\u0442\u043e\u0440 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0438\u043b\u044b<\/figcaption><\/div>\n<\/figure>\n<p>\u0411\u0443\u0434\u0435\u043c \u0440\u0435\u0433\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c (\u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c) \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c \u043a\u043e\u043b\u0435\u0431\u0430\u043d\u0438\u0439 \u043c\u0430\u044f\u0442\u043d\u0438\u043a\u0430 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u0441\u0438\u043b\u044b, \u043f\u0440\u0438\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u043a\u0430\u0431\u0435\u043b\u044e. \u041f\u0440\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u0441\u0438\u043b\u044b, \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043a \u043d\u043e\u0432\u043e\u043c\u0443.<\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u0432\u0435\u0434\u0435\u043c \u0432\u0435\u043a\u0442\u043e\u0440 FVector GeneralForce, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438 \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u043c \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0438\u043b\u044b, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u043e\u0434\u0447\u0438\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c \u043a\u043e\u043b\u0435\u0431\u0430\u043d\u0438\u044f \u043c\u0430\u044f\u0442\u043d\u0438\u043a\u0430.<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043c\u0435\u0442\u043e\u0434 VerletIntegrate() \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043a\u0443\u0441\u043a\u0438 \u043a\u043e\u0434\u0430:<\/p>\n<p>\u041a\u043e\u0434 \u0437\u0430\u043d\u0443\u043b\u0435\u043d\u0438\u044f \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0438\u043b\u044b:<\/p>\n<pre><code class=\"cpp\">if (FMath::IsNearlyZero(omg)) \/\/ \u0415\u0441\u043b\u0438 \u0443\u0433\u043b\u043e\u0432\u0430\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043c\u0430\u044f\u0442\u043d\u0438\u043a\u0430 \u0431\u043b\u0438\u0437\u043a\u0430 \u043a \u043d\u0443\u043b\u044e { GeneralForce = { 0, 0, 0 }; }<\/code><\/pre>\n<p>\u041a\u043e\u0434 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0438\u043b\u044b \u0438 \u043f\u0440\u0438\u0434\u0430\u043d\u0438\u044f \u0441\u0438\u043b\u044b \u043c\u0430\u044f\u0442\u043d\u0438\u043a\u0443 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u043e\u0440\u0443\u0436\u0438\u044f:<\/p>\n<pre><code class=\"cpp\">Vel = GetOwner()-&gt;GetOwner()-&gt;GetActorLocation() - OldBibelotLoc; if (!Vel.IsNearlyZero()) { VelForce = -Vel.GetSafeNormal(); float FinalOmgVelChange = CachedCharacter-&gt;GetVelocity().IsNearlyZero() ? AVelChangeNoVelocity : AVelChangeVelocity; A += FinalOmgVelChange * Vel.Length(); } GeneralForce = UKismetMathLibrary::VInterpTo(GeneralForce, VelForce, DeltaTime, GeneralForceInterpSpeed);<\/code><\/pre>\n<p><strong>(*)<\/strong> \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 OldBibelotLoc \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u0441\u0430\u043c\u043e\u043c \u043a\u043e\u043d\u0446\u0435 \u0442\u0438\u043a\u0430 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430, \u0438 \u0440\u0430\u0432\u043d\u044f\u0435\u0442\u0441\u044f GetOwner()-&gt;GetOwner()-&gt;GetActorLocation().<\/p>\n<p>\u0418\u0437\u043c\u0435\u043d\u0438\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0432\u0435\u043a\u0442\u043e\u0440\u0430 NewPosition:<\/p>\n<pre><code class=\"cpp\">NewPosition = BackRotateToXAxis(GeneralForce, XZVec) + Particles[0].Position;<\/code><\/pre>\n<p>\u0413\u0434\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-456213","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/456213","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=456213"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/456213\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=456213"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=456213"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=456213"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}