いくつかの方法UE4は、オブジェクトを移動します

転送:https://dawnarc.com/2016/06/ue4%E7%A7%BB%E5%8A%A8%E7%89%A9%E4%BD%93%E7%9A%84%E5%87% A0%E7%A7%8D% E6%96%B9%E6%B3%95 /

1、Actor-> SetActorLocation

Actor-> SetActorLocation()

2、AActor :: AddActorWorldOffset()、AActor :: AddActorLocalOffset()

AddActorWorldOffset異なるAddActorLocalOffset:所望の俳優世界の方向に沿って移動した場合の座標系、そして次いでDeltaLocation AddActorWorldOffsetワールド座標系のパラメータを使用して、所望の出演俳優がローカル次に、システムは、電流の方向に沿って移動させる相対座標パラメータを使用する場合とAddActorLocalOffsetオフセット現在俳優のDeltaLocationは、(例えば、スパイラルトラックを望んでいたが、世界はLocalOffsetを使用し、その後、空間座標を計算する必要はありません)。

あなたがAddActorWorldOffsetまたはAddActorLocalOffset移動文字を使用する場合は、MovementModeが飛ぶように設定、またはときDeltaLocation小さなされている必要があり、文字は常に、(も、あなた無効物理シミュレーションの場合)落ちるだろうUCharacterMovementComponent::SetMovementMode(EMovementMode::MOVE_Flying);またはUnpossessコントローラ。

3、ベロシティ

ACharacter-> GetCharacterMovement() - >速度+ = FVector(5 .F、5 .F、0 .F)。

図4に示すように、コントローラ(PlayerControllerまたはAIController)を呼び出して、一方に俳優を有します。

Controller->のMoveTo();

次いで、図5に示すように、コントローラ(PlayerController又はAIController)のいずれかに俳優を有する、コール

GetWorld() - > GetNavigationSystem() - > SimpleMoveToLocation(コントローラ、一箇所)。

注:移動機能をController->のMoveToまたは使用ナビゲーションシステムを使用する場合は、あなたがそれ以外の場合は無効、ナビゲーションコンポーネントを使用して地形を構築し提供。

6、APawn-> AddMovementInput

APawn-> AddMovementInput(FVector WorldDirection、フロート ScaleValue = 1.0FBOOL bForce = )。

WorldDirection方向は、速度レートScaleValueは、属性値を無視するかどうかにbForce IgnoreMoveInputコントローラを表す強制的に移動させます。

7、UCharacterMovementComponent :: A ddImpulse

 UCharacterMovementComponent :: AddImpulse(FVectorインパルス、BOOL bVelocityChange)

AddImpulseは、一般的に投げ、物理学、爆発、クロバエなどに使用します。各フレームに対処する必要はありませんした後に追加され、力のモーメントです。

注:オブジェクトのAddImpulse役割は、一般的にStaticMeshComponentですが、そうでない場合は無効CollisionComponent、することはできません。物理的およびStaticMeshComponent有効にするには:SetSimulatePhysics(true)を、それ以外の場合は無効です。

8、UCharacterMovementComponent :: AddForce

 UCharacterMovementComponent :: AddForce(FVectorフォース)

あなたは動き続けることを目的とする必要がある場合は、すべてのフレームAddForce()関数を実行する必要があり、また、リアルタイムでの加速が変更された場合、それが使用AddForceことができると述べました。両者の差:
AddForce accounts for delta time and should be used for applying force over more than one frame, AddImpulse does not account for delta time and should be used for single 'pushes', like from an explosion or being thrown by a player. The reason is that if you use AddForce for throwing or an explosion, how far the object moves depends on the framerate at the exact frame the force was applied, rather than being independent of framerate like AddImpulse is.

参考:
https://forums.unrealengine.com/showthread.php?29496-Addforce-and-addimpulse

9、UKismetSystemLibrary :: MoveComponentTo

FLatentActionInfo ActionInfo; 
ActionInfo.CallbackTargetは = この; 
UKismetSystemLibrary :: MoveComponentTo(TopDownCameraComponent、場所、ローテーション、1 .F、、EMoveComponentAction ::移動、ActionInfo)。

通常、身体の動きに俳優コンポーネント、例えばCameraComponentのような。滑らかな動きをサポートするためには、目標位置、回転長いプロセスを移動するために設けられてもよいです。

おすすめ

転載: www.cnblogs.com/sevenyuan/p/11850076.html