利用第三方后期处理材质(PostProcess Material)对物体进行描边【

2019-01-26 21:33

利用第三方后期处理材质(PostProcess Material)对物体进行描边【UE4】【C++】

完整代码如下: MyPlayer.h

[cpp] view plain copy 在CODE上查看代码片派生到我的代码片

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include \ #include \

UCLASS()

class OUTLINECPLUSPLUS_API AMyPlayer : public ACharacter {

GENERATED_BODY()

public:

// Sets default values for this character's properties AMyPlayer();

void MoveForward(float val); void MoveRight(float val); void LookYaw(float val);

void LookPitch(float val); void Use();

class AInteractableActor* FindFocusedActor(); void HandleHighlight();

// Called when the game starts or when spawned virtual void BeginPlay() override;

// Called every frame

virtual void Tick( float DeltaSeconds ) override;

// Called to bind functionality to input

virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;

private:

UPROPERTY(EditDefaultsOnly)

float InteractionDistance = 300.f; // 交互的范围 class AInteractableActor* FocusedActor; // 用于 LineTraceSingleByChannel FCollisionQueryParams TraceParams; };

MyPlayer.cpp

[cpp] view plain copy 在CODE上查看代码片派生到我的代码片

// Fill out your copyright notice in the Description page of Project Settings. #include \ #include \

// Sets default values

AMyPlayer::AMyPlayer() {

// Set this character to call Tick() every frame. You can turn this off to improve performance if you dwww.sm136.comon't need it.

PrimaryActorTick.bCanEverTick = true;

TraceParams = FCollisionQueryParams(FName(TEXT(\ TraceParams.bTraceComplex = false; TraceParams.bTraceAsyncScene = false;

TraceParams.bReturnPhysicalMaterial = false; }

// Called when the game starts or when spawned

void AMyPlayer::BeginPlay() {

Super::BeginPlay(); }

// Called every frame

void AMyPlayer::Tick( float DeltaTime ) {

Super::Tick( DeltaTime );

if (Controller && Controller->IsLocalController()) {

HandleHighlight(); } }

// Called to bind functionality to input

void AMyPlayer::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) {

Super::SetupPlayerInputComponent(PlayerInputComponent);

InputComponent->BindAxis(\ InputComponent->BindAxis(\ InputComponent->BindAxis(\ InputComponent->BindAxis(\ InputComponent->BindAction(\ }

// 前后移动

void AMyPlayer::MoveForward(float val) {

FRotator Rotation(0, GetActorRotation().Yaw, 0); // Roll, Yaw, Pitch FVector forward = FRotationMatrix(Rotation).GetScaledAxis(EAxis::X); AddMovementInput(forward, val); }

// 左右移动

void AMyPlayer::MoveRight(float val) {

FRotator Rotation(0, GetActorRotation().Yaw, 0); // Roll, Yaw, Pitch FVector right = FRotationMatrix(Rotation).GetScaledAxis(EAxis::Y); AddMovementInput(right, val);


利用第三方后期处理材质(PostProcess Material)对物体进行描边【.doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:发展分享经济,共建自备电站的可行性分析报告

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: