在源码实现中,【相对坐标】以【FVector】类型成员变量存储于【SceneComponent】组件的【RelativeLocation】中,所以可以直接获取出来,也提供了对应的修改函数,修改后会同时更新上述【绝对坐标】中的三维转换矩阵。同理【相对旋转】、【相对缩放】也是以类似独立字段进行存储: 1)设置:【SceneComponent::SetRelativeLocation 函...
1)设置:【SceneComponent::SetRelativeLocation 函数】或【Actor::SetActorRelativeLocation 函数】;2)...
调用如下函数: MSkeletaMeshComponent->SetRelativeLocation(FVector(0,0,-90)); 显示效果: MSkeletaMeshComponent->SetRelativeLocation(FVector(0,0,-160)); MSkeletaMeshComponent->SetRelativeLocation(FVector(0,90,-90)); MSkeletaMeshComponent->SetRelativeLocation(FVector(90,0,-90)); 总结: 改变x的值,...
SetActorLocation 设置Actor的位置,应该是全局位置 GetActorLocation 获取Actor的位置 SetRelativeTransform 设置相对的transform SetLifeSpan 设置Actor存活时间 DestoryActor 删除Actor DestoryComponent 删除组件 Get Owner 获取拥有者 SetVisibility 设置显示或隐藏 GetActorForwardVector 得到Actor的正方向 GetActorRightVector ...
GetMesh()->SetRelativeLocation(FVector(0,0,-90)); //设置模型面朝方向 GetMesh()->SetRelativeRotation(FRotator(0,-90,0)); 编译一下,回到编辑器中,发现我们的摄像机已经添加了进去。 完整代码如下。 1) PlayingCharacter.h // Fill out your copyright notice in the Description page of Project Set...
SpringArm->SetRelativeLocation(FVector(-40,0,0)); SpringArm->TargetArmLength=400;//弹簧臂长度 SpringArm->bEnableCameraLag=true;//是否平滑 SpringArm->CameraLagSpeed=3;//平滑速度 UCameraComponent* Camera=CreateDefaultSubobject<UCameraComponent>(TEXT("ActualCamera")); ...
GetMesh()->SetRelativeLocation(FVector(0, 0, -95.f)); GetMesh()->SetRelativeRotation(FRotator(0,-90.f,0.f)); //创建一个摄像机目标点 USpringArmComponent 设置父级 长度 可旋转 CameraBoom = CreateDefaultSubobject(TEXT("CameraBoom")); ...
我写的SpawnActor测试代码voidABOCPLUSPLUSGameModeBase::BeginPlay(){Super::BeginPlay();AActor*pActor=GWorld->SpawnActor(AActor::StaticClass());pActor->SetActorLocation(FVector::ZeroVector);} 2>源码分析 下图是调用的堆栈 下面是SpawnActor里面的实现,贴出来吧,代码比较多。我写点注释记录一下 ...
pChildComponent->SetRelativeLocation(FVector(i * Length * fxDir, j * Width * fyDir, k * Height * fzDir)); pChildComponent->AttachToComponent(RootComponent, FAttachmentTransformRules::KeepRelativeTransform); pChildComponent->SetSimulatePhysics(bUsePhysics); ...
NewMove->SavedRelativeLocation : NewMove->SavedLocation; // -constFVector SendLocation=MovementBaseUtility::UseRelativeLocation(ClientMovementBase)?NewMove->SavedRelativeLocation:FRepMovement::RebaseOntoZeroOrigin(NewMove->SavedLocation,this);// +// send old move if it existsif(OldMove){ServerMoveOl...