2.3.1 MoveCharacter,实现人物前后左右移动 利用Get Actor Rotation获得当前的Actor的朝向(Roll Pitch Yaw)。然后,利用Get Forward Vector和Get Right Vector获得当前朝向作为基准时,指向Forward的向量和指向Right的向量(均为单位向量)。最后,利用Add Movement Input节点,实现Character朝着向量所知的方向进行移动。 2.3.2...
最常见的get controlled pawn是获取被player controller控制的pawn 至于如何设置player controller控制的pawn可以在game mode里设置,默认的pawn类就是玩家控制的pawn get actor forward vector(获取actor x轴所指向量) get actor right vector(获取actor y轴所指向量) get actor up vector(获取actor z轴所指向量) ...
// find out which way is right const FRotator Rotation = Controller->GetControlRotation(); const FRotator YawRotation(0, Rotation.Yaw, 0); // get right vector const FVector Direction = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::Y); // add movement in that direction AddMovementInput(D...
Grid.GetGridValue(IndexX,IndexY,IndexZ,VectorIndex+2, VZ_self); floatVZ_right; Grid.GetGridValue(IndexX+1,IndexY,IndexZ,VectorIndex+2, VZ_right); floatVZ_left; Grid.GetGridValue(IndexX-1,IndexY,IndexZ,VectorIndex+2, VZ_left); floatVZ_up; Grid.GetGridValue(IndexX,IndexY+1,Index...
Grid.GetGridValue(IndexX+1,IndexY,IndexZ,VectorIndex, VX_right); float VX_left; Grid.GetGridValue(IndexX-1,IndexY,IndexZ,VectorIndex, VX_left); float VX_up; Grid.GetGridValue(IndexX,IndexY+1,IndexZ,VectorIndex, VX_up); float VX_down; ...
MovementInput.IsZero()) { // 把移动输入轴的值每秒缩放100个单位 MovementInput = MovementInput.SafeNormal() * 100.0f; FVector NewLocation = GetActorLocation(); NewLocation += GetActorForwardVector() * MovementInput.X * DeltaTime; NewLocation += GetActorRightVector() * MovementInput.Y * ...
The translations of the real camera are multiplied by the Translation Multiplier vector’s values. It can be used to lock completely an axis, or to intensify the translations.Run the Scene # After a short initialization period, you will see the virtual scene from the ZEDPawn position. Your ...
Grid.GetGridValue(IndexX,IndexY,IndexZ,VectorIndex, VX_self); float VX_right; Grid.GetGridValue(IndexX+1,IndexY,IndexZ,VectorIndex, VX_right); float VX_left; Grid.GetGridValue(IndexX-1,IndexY,IndexZ,VectorIndex, VX_left); float VX_up; ...
1)计算inputVector与forwardVector的夹角,看是否超过30度,用cos判断就是,看是否小于0.87 2)如果没超,那就朝WSAD方向旋转,如果超了,跳到3) 3)计算与forwardVector的夹角为30度的向量,会有两个,记为left30Vector和right30Vector;此时,我们需要根据inputVector与rightVector的cos值来判断要哪个(锐角cos>0,顿角cos<...
FORCEINLINE UTextureRenderTarget2D* GetRTT2D()const{returnthis->mRTT2D; } UFUNCTION(BlueprintCallable)voidCapture(constuint8 PreCaptureFrameNum =2); UFUNCTION(BlueprintCallable)voidCaptureFromLocationAndRotation(constFVector& Location =FVector::ZeroVector,constFRotator& Rotator =FRotator::ZeroRotator,const...