Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Source/VRCode.Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ public class VRCodeTarget : TargetRules
public VRCodeTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Game;
ExtraModuleNames.AddRange(new string[] { "VRCode" });
}
ExtraModuleNames.AddRange(new string[] { "VRCode" });
}
}
6 changes: 3 additions & 3 deletions Source/VRCode/GamepadVRPawn.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class VRCODE_API AGamepadVRPawn : public APawn

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

// Called every frame
virtual void Tick( float DeltaSeconds ) override;

Expand All @@ -90,8 +90,8 @@ class VRCODE_API AGamepadVRPawn : public APawn
UFUNCTION()
void FinishTeleport();

void ExecuteTeleport();
void ExecuteTeleport();
void ActivateTeleport();


};
6 changes: 3 additions & 3 deletions Source/VRCode/IPickupable.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ class UPickupable : public UInterface
};

/**
*
*
*/
class VRCODE_API IPickupable
{
GENERATED_IINTERFACE_BODY()

// Add interface functions to this class. This is the class that will be inherited to implement this interface.
public:

UFUNCTION( BlueprintNativeEvent, BlueprintCallable, Category = "Pickupable Interface" )
void Pickup( class USceneComponent *AttachTo );

UFUNCTION( BlueprintNativeEvent, BlueprintCallable, Category = "Pickupable Interface" )
void Drop();

};
4 changes: 2 additions & 2 deletions Source/VRCode/PickupCube.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// Sets default values
APickupCube::APickupCube()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;

StaticMeshComponent = CreateDefaultSubobject<UStaticMeshComponent>( TEXT( "StaticMeshComponent" ) );
Expand All @@ -25,7 +25,7 @@ APickupCube::APickupCube()
void APickupCube::BeginPlay()
{
Super::BeginPlay();

}

// Called every frame
Expand Down
10 changes: 5 additions & 5 deletions Source/VRCode/PickupCube.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@ class VRCODE_API APickupCube : public AActor, public IPickupable
UPROPERTY( VisibleAnywhere, BlueprintReadOnly, Category = "Code Components", meta = ( AllowPrivateAccess = "true" ) )
class UStaticMeshComponent *StaticMeshComponent;

public:
public:
// Sets default values for this actor's properties
APickupCube();

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

// Called every frame
virtual void Tick( float DeltaSeconds ) override;

//
//
// UFUNCTION( BlueprintNativeEvent, BlueprintCallable, Category = "Pickupable Interface" )
// void Pickup( class USceneComponent *AttachTo );
virtual void Pickup_Implementation( class USceneComponent *AttachTo );
//
//UFUNCTION( BlueprintNativeEvent, BlueprintCallable, Category = "Pickupable Interface" )
//
//UFUNCTION( BlueprintNativeEvent, BlueprintCallable, Category = "Pickupable Interface" )
// void Drop();
virtual void Drop_Implementation();

Expand Down
12 changes: 6 additions & 6 deletions Source/VRCode/TP_VRPawn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// Sets default values
AVRPawn::AVRPawn()
{
// Set this pawn to call Tick() every frame. You can turn this off to improve performance if you don't need it.
// Set this pawn to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;

VROrigin = CreateDefaultSubobject<USceneComponent>(TEXT("VROrigin"));
Expand Down Expand Up @@ -57,7 +57,7 @@ void AVRPawn::BeginPlay()
// PSVR
hmd->SetTrackingOrigin(EHMDTrackingOrigin::Eye);

// Set Height Offset for Tracking
// Set Height Offset for Tracking
VROrigin->AddLocalOffset( FVector( 0, 0, DefaultPlayerHeight ) );
}
}
Expand Down Expand Up @@ -101,7 +101,7 @@ void AVRPawn::ExecuteTeleport( AVRHand *Current )
// Fade out screen
APlayerCameraManager *PlayerCamera = UGameplayStatics::GetPlayerCameraManager( GetWorld(), 0 );
PlayerCamera->StartCameraFade( 0, 1, FadeOutDuration, TeleportFadeColor, false, true );

// Wait for Fade to complete before continuing the teleport
FTimerHandle TimerHandle;
FTimerDelegate TimerDelegate;
Expand Down Expand Up @@ -145,9 +145,9 @@ void AVRPawn::HandleStickInputStyleTeleportActivation( FVector2D AxisInput, AVRH
if ( Other )
Other->DisableTeleporter();
}
else
else
{
if ( Current && Current->IsTeleporterActive )
if ( Current && Current->IsTeleporterActive )
ExecuteTeleport( Current );
}
}
Expand Down Expand Up @@ -223,7 +223,7 @@ void AVRPawn::Tick( float DeltaTime )
if ( GetRotationFromInput( Right, ThumbRight, OrientRotator ) || ControlScheme != ETeleportControlScheme::StickOnly )
Right->TeleportRotator = OrientRotator;
}


}

Expand Down
10 changes: 5 additions & 5 deletions Source/VRCode/TP_VRSimplePawn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// Sets default values
AGamepadVRPawn::AGamepadVRPawn()
{
// Set this pawn to call Tick() every frame. You can turn this off to improve performance if you don't need it.
// Set this pawn to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;

Scene = CreateDefaultSubobject<USceneComponent>( TEXT( "Scene" ) );
Expand All @@ -28,7 +28,7 @@ AGamepadVRPawn::AGamepadVRPawn()

TraceDirection = CreateDefaultSubobject<UArrowComponent>( TEXT( "TraceDirection" ) );
TraceDirection->SetupAttachment( Camera );

TeleportPin = CreateDefaultSubobject<UStaticMeshComponent>( TEXT( "TeleportPin" ) );
TeleportPin->SetupAttachment( Scene );

Expand Down Expand Up @@ -59,7 +59,7 @@ void AGamepadVRPawn::BeginPlay()
// PSVR
hmd->SetTrackingOrigin( EHMDTrackingOrigin::Eye );

// Set Height Offset for Tracking
// Set Height Offset for Tracking
VROrigin->AddLocalOffset( FVector( 0, 0, DefaultPlayerHeight ) );
}
}
Expand Down Expand Up @@ -174,7 +174,7 @@ void AGamepadVRPawn::Tick( float DeltaTime )
TeleportPin->SetVisibility( CurrentLocationValid, true );
}


// Update Teleport Meshes Position and Orientations
bool bShouldUpdateFacing = false;
if ( bUseGamepad )
Expand Down Expand Up @@ -252,7 +252,7 @@ bool AGamepadVRPawn::GetTeleportDirection( FVector &OutLocation )
if ( !DidProjectToNav )
return false;


OutLocation = ProjectedHitLocation.Location;
return true;
}
2 changes: 1 addition & 1 deletion Source/VRCode/VRCode.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public VRCode(ReadOnlyTargetRules ROTargetRules) : base(ROTargetRules)

// Uncomment if you are using Slate UI
// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });

// Uncomment if you are using online features
// PrivateDependencyModuleNames.Add("OnlineSubsystem");

Expand Down
10 changes: 5 additions & 5 deletions Source/VRCode/VRCodeGameModeBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
#include "VRCodeGameModeBase.generated.h"

/**
*
*
*/
UCLASS()
class VRCODE_API AVRCodeGameModeBase : public AGameModeBase
{
GENERATED_BODY()




};
32 changes: 16 additions & 16 deletions Source/VRCode/VRHand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ AVRHand::AVRHand() :
{


// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;

Hand = EControllerHand::Right;
Expand All @@ -42,7 +42,7 @@ AVRHand::AVRHand() :
HandMesh->SetupAttachment( MotionController );

GrabSphere = CreateDefaultSubobject<USphereComponent>( TEXT( "GrabSphere" ) );
GrabSphere->SetupAttachment( HandMesh );
GrabSphere->SetupAttachment( HandMesh );
GrabSphere->InitSphereRadius( 10.0f );
GrabSphere->OnComponentBeginOverlap.AddDynamic( this, &AVRHand::OnComponentBeginOverlap );

Expand All @@ -64,7 +64,7 @@ AVRHand::AVRHand() :

TeleportArrow = CreateDefaultSubobject<UStaticMeshComponent>( TEXT( "TeleportArrow" ) );
TeleportArrow->SetupAttachment( TeleportCylinder );

}

void AVRHand::OnConstruction(const FTransform & Transform)
Expand Down Expand Up @@ -145,8 +145,8 @@ AActor* AVRHand::GetActorNearHand()

// if ( GEngine && Hand == EControllerHand::Right )
// GEngine->AddOnScreenDebugMessage( -1, 0.16f, FColor::Red,
// FString::Printf( TEXT( "Actors near right hand %d, found pickupable: %d, %s" ),
// overlappingActors.Num(),
// FString::Printf( TEXT( "Actors near right hand %d, found pickupable: %d, %s" ),
// overlappingActors.Num(),
// count,
// nearest ? TEXT( "TRUE" ) : TEXT( "FALSE" ) ) );

Expand All @@ -169,7 +169,7 @@ void AVRHand::UpdateAnimationGripState()
if ( WantsToGrip )
Grip = EGripState::Grab;

// If not holding something, the hand should open or close
// If not holding something, the hand should open or close
// slightly when passing over an interactable object
AActor *actor = GetActorNearHand();
if ( actor )
Expand Down Expand Up @@ -255,7 +255,7 @@ void AVRHand::Tick( float DeltaTime )
// Rotate Arrow
FRotator ArrowRotator = TeleportRotator;

IHeadMountedDisplay *hmd = GEngine->HMDDevice.Get();
IHeadMountedDisplay *hmd = GEngine->HMDDevice.Get();
if ( hmd )
{
FRotator DeviceRotation;
Expand All @@ -269,7 +269,7 @@ void AVRHand::Tick( float DeltaTime )
}

TeleportArrow->SetWorldRotation( ArrowRotator );

// Make Spline....
if ( TracePoints.Num() > 0 )
{
Expand All @@ -289,7 +289,7 @@ void AVRHand::Tick( float DeltaTime )
FVector EndTangent = ArcSpline->GetTangentAtSplinePoint( i + 1, ESplineCoordinateSpace::Local );

USplineMeshComponent *SplineMeshComponent;

if ( i >= SplineMeshes.Num() )
{
SplineMeshComponent = NewObject<USplineMeshComponent>( this, USplineMeshComponent::StaticClass() );
Expand All @@ -315,15 +315,15 @@ void AVRHand::Tick( float DeltaTime )
RegisterAllComponents();
}


}

// If it changed, rumble.
if ( LastIsValidTeleportDestination != IsValidTeleportDestination )
RumbleController( 0.3 );
LastIsValidTeleportDestination = IsValidTeleportDestination;
}

}

void AVRHand::ActivateTeleporter()
Expand All @@ -339,7 +339,7 @@ void AVRHand::ActivateTeleporter()
void AVRHand::DisableTeleporter()
{
IsTeleporterActive = false;

TeleportCylinder->SetVisibility( false, true );
ArcEndPoint->SetVisibility( false );

Expand All @@ -359,17 +359,17 @@ bool AVRHand::TraceTeleportDestination( TArray<FVector> &TracePoints, FVector &N
LaunchVelocity *= TeleportLaunchVelocity;

// Predict Projectile Path

FPredictProjectilePathParams PredictParams( 0.0f, StartPos, LaunchVelocity, 4.0f, UEngineTypes::ConvertToObjectType( ECC_WorldStatic ) );
FPredictProjectilePathResult PredictResult;
const bool DidPredictPath = UGameplayStatics::PredictProjectilePath( GetWorld(), PredictParams, PredictResult );
if ( !DidPredictPath )
return false;

// Getting Projected Endpoint

FVector PointToProject = PredictResult.HitResult.Location;
FNavLocation ProjectedHitLocation;
FNavLocation ProjectedHitLocation;
UNavigationSystem *NavSystem = GetWorld()->GetNavigationSystem();
const bool DidProjectToNav = NavSystem->ProjectPointToNavigation( PointToProject, ProjectedHitLocation, Extents );
if ( !DidProjectToNav )
Expand All @@ -382,7 +382,7 @@ bool AVRHand::TraceTeleportDestination( TArray<FVector> &TracePoints, FVector &N
TracePoints.Push( Point.Location );

TraceLocation = PredictResult.HitResult.Location;
NavMeshLocation = ProjectedHitLocation.Location;
NavMeshLocation = ProjectedHitLocation.Location;

return true;
}
Expand Down
8 changes: 4 additions & 4 deletions Source/VRCode/VRHand.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ class VRCODE_API AVRHand : public AActor

UPROPERTY( VisibleAnywhere, BlueprintReadOnly, Category = "Code Components", meta = ( AllowPrivateAccess = "true" ) )
class UStaticMeshComponent *TeleportArrow;


FRotator InitialControllerRotation;
TArray<class USplineMeshComponent*> SplineMeshes;
public:
public:

UPROPERTY( EditAnywhere, BlueprintReadWrite, Category = "Code Constants" )
class UStaticMesh *BeamMesh;
Expand Down Expand Up @@ -98,12 +98,12 @@ class VRCODE_API AVRHand : public AActor

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

// Called every frame
virtual void Tick( float DeltaSeconds ) override;

virtual void OnConstruction( const FTransform & Transform ) override;

UFUNCTION()
void OnComponentBeginOverlap( UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult );

Expand Down
Loading