NVIDIA DeepLearning Dataset Synthesizer (NDDS)
 All Classes Namespaces Functions Variables Typedefs Pages
RandomMovementComponent.h
1 /*
2 * Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
3 *
4 * NVIDIA CORPORATION and its licensors retain all intellectual property
5 * and proprietary rights in and to this software, related documentation
6 * and any modifications thereto. Any use, reproduction, disclosure or
7 * distribution of this software and related documentation without an express
8 * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 */
10 
11 #pragma once
12 
13 #include "DomainRandomizationDNNPCH.h"
14 #include "RandomComponentBase.h"
15 #include "RandomMovementComponent.generated.h"
16 
17 /// @cond DOXYGEN_SUPPRESSED_CODE
18 UCLASS(Blueprintable, ClassGroup = (NVIDIA), meta = (BlueprintSpawnableComponent))
19 /// @endcond DOXYGEN_SUPPRESSED_CODE
20 class DOMAINRANDOMIZATIONDNN_API URandomMovementComponent : public URandomComponentBase
21 {
22  GENERATED_BODY()
23 
24 public:
26 
27  AVolume* GetRandomLocationVolume() const
28  {
29  return RandomLocationVolume;
30  }
31  void SetRandomLocationVolume(AVolume* NewVolume, bool bForceUseVolume = false);
32 
33 protected: // Editor properties
34 
35  // If true, the owner will be moving around its original location
36  // Otherwise the random location will be selected in the RandomLocationVolume
37  UPROPERTY(EditAnywhere)
38  bool bRelatedToOriginLocation;
39 
40  UPROPERTY(EditAnywhere, meta = (EditCondition = "bRelatedToOriginLocation"))
41  FRandomLocationData RandomLocationData;
42 
43  // If true, the location will be picked along the object's axes instead of the world axes
44  UPROPERTY(EditAnywhere, meta = (EditCondition = "bRelatedToOriginLocation"))
45  bool bUseObjectAxesInsteadOfWorldAxes;
46 
47  // The volume to choose a random location from
48  UPROPERTY(EditAnywhere, meta = (EditCondition = "!bRelatedToOriginLocation"))
49  AVolume* RandomLocationVolume;
50 
51  // If true, the actor will instantly teleport whenever location changed
52  // otherwise the object will move toward the new location with speed in the RandomSpeedRange
53  UPROPERTY(EditAnywhere)
54  bool bShouldTeleport;
55 
56  // If true, the actor will not be able to move if its way is blocked
57  // Otherwise the actor can go through other object or teleport overlap with the other
58  UPROPERTY(EditAnywhere)
59  bool bCheckCollision;
60 
61  UPROPERTY(EditAnywhere, meta=(EditCondition="!bShouldTeleport"))
62  FFloatInterval RandomSpeedRange;
63 
64 protected:
65  void BeginPlay() override;
66  void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
67 
68  void OnRandomization_Implementation() override;
69  void OnFinishedRandomization() override;
70 
71 protected:
72  bool bIsMoving;
73  FVector TargetLocation;
74  float CurrentSpeed;
75 
76  UPROPERTY(Transient)
77  FTransform OriginalTransform;
78 };