A Demo Project for the UnrealEngineSDK
Loading...
Searching...
No Matches
GrippableCharacter.cpp
Go to the documentation of this file.
1// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
2
5#include "VRGlobalSettings.h"
6
7
8AGrippableCharacter::AGrippableCharacter(const FObjectInitializer& ObjectInitializer)
9 : Super(ObjectInitializer.SetDefaultSubobjectClass(ACharacter::MeshComponentName, UVRGlobalSettings::GetDefaultGrippableCharacterMeshComponentClass()))
10
11{
12 ViewOriginationSocket = NAME_None;
13 GrippableMeshReference = Cast<UGrippableSkeletalMeshComponent>(GetMesh());
14}
15
16void AGrippableCharacter::GetActorEyesViewPoint(FVector& Location, FRotator& Rotation) const
17{
18 if (ViewOriginationSocket != NAME_None)
19 {
20 if (USkeletalMeshComponent* MyMesh = GetMesh())
21 {
22 FTransform SocketTransform = MyMesh->GetSocketTransform(ViewOriginationSocket, RTS_World);
23 Location = SocketTransform.GetLocation();
24 Rotation = SocketTransform.GetRotation().Rotator();
25 return;
26 }
27 }
28
29 Super::GetActorEyesViewPoint(Location, Rotation);
30}
FName ViewOriginationSocket
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "AI")
virtual void GetActorEyesViewPoint(FVector &Location, FRotator &Rotation) const override
AGrippableCharacter(const FObjectInitializer &ObjectInitializer=FObjectInitializer::Get())
UGrippableSkeletalMeshComponent * GrippableMeshReference
UPROPERTY(Category = GrippableCharacter, VisibleAnywhere, Transient, BlueprintReadOnly,...
UCLASS(config = Engine, defaultconfig)