RapyutaSimulationPlugins
RobotVehicleMovementComponent.h
Go to the documentation of this file.
1 
13 #pragma once
14 
15 
16 
17 // System
18 
19 #include <random>
20 
21 
22 
23 // UE
24 
25 #include "CoreMinimal.h"
26 
27 #include "GameFramework/PawnMovementComponent.h"
28 
29 
30 
31 // RapyutaSimulationPlugins
32 
34 
35 
36 
37 #include "RobotVehicleMovementComponent.generated.h"
38 
39 
40 
41 class ARRBaseRobot;
42 
44 
45 
46 
84 class RAPYUTASIMULATIONPLUGINS_API URobotVehicleMovementComponent : public UPawnMovementComponent
85 
86 {
87 
88 
89 
90 private:
91 
92  // For Elevator management
93 
95 
96 
101  AActor* MovingPlatform = nullptr;
102 
103 
104 
105 
110  FVector LastPlatformLocation = FVector::ZeroVector;
111 
112 
113 
114 
119  FQuat LastPlatformRotation = FQuat::Identity;
120 
121 
122 
124 
126 
127 
128 
129 
134  TArray<USceneComponent*> ContactPoints;
135 
136 
137 
138 public:
139 
140 
145  ARRBaseRobot* OwnerVehicle = nullptr;
146 
147 
148 
149 
154  TObjectPtr<URRFloatingMovementComponent> AIMovementComp = nullptr;
155 
156 
157 
169  void InitAIMovementComp();
170 
171 
172 
185  virtual void SetUpdatedComponent(USceneComponent* InNewUpdatedComponent) override;
186 
187 
188 
190 
191 
196  FVector AngularVelocity = FVector::ZeroVector;
197 
198 
199 
201 
203 
205 
206 
211  FVector DesiredMovement = FVector::ZeroVector;
212 
213 
214 
216 
217 
222  FQuat DesiredRotation = FQuat::Identity;
223 
224 
225 
226  // For slopes, complex floors, free fall
227 
228 
229 
231 
232 
237  float RayOffsetUp = 10.f;
238 
239 
240 
242 
244 
245 
250  float RayOffsetDown = 20.f;
251 
252 
253 
255 
256 
261  bool bAdaptToSurfaceBelow = true;
262 
263 
264 
278  virtual void Initialize();
279 
280 
281 
283 
284 
289  int8 InversionFactor = 1;
290 
291 
292 
308  virtual void InitData();
309 
310 
311 
312 
317  void SetMovingPlatform(AActor* platform);
318 
319 
320 
321 
326  bool IsOnMovingPlatform();
327 
328 
329 
330 
335  void RemoveMovingPlatform();
336 
337 
338 
339  // For slopes, complex floors, free fall
340 
341 
342 
344 
345 
350  float MinDistanceToFloor = 0.f;
351 
352 
353 
355 
356 
361  float FallingSpeed = 100.f;
362 
363 
364 
366 
367 
372  URRBaseOdomComponent* OdomComponent = nullptr;
373 
374 
375 
376 protected:
377 
378  virtual bool IsSupportedForNetworking() const override
379 
380  {
381 
382  return true;
383 
384  }
385 
386 
387 
408  virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
409 
410 
411 
444  virtual void UpdateMovement(float InDeltaTime);
445 
446 
447 
449 
450 
455  float LogLastHit = 0.f;
456 
457 };
458 
URobotVehicleMovementComponent
Base Robot vehicle movement class which is used as part of ARobotVehicle.
Definition: RobotVehicleMovementComponent.h:84
URRBaseOdomComponent
Base Odom Component which provide actor pose changes.
Definition: RRBaseOdomComponent.h:85
URobotVehicleMovementComponent::IsSupportedForNetworking
virtual bool IsSupportedForNetworking() const override
Definition: RobotVehicleMovementComponent.h:378
URobotVehicleMovementComponent::ContactPoints
TArray< USceneComponent * > ContactPoints
List all scene components on the pawn. that have the tag "ContactPoint". This is used to adapt the ro...
Definition: RobotVehicleMovementComponent.h:134
RRBaseOdomComponent.h
Base Odom Component which provides actor pose changes.
URRFloatingMovementComponent
Base Robot floating movement class.
Definition: RRFloatingMovementComponent.h:50
ARRBaseRobot
Base Robot class. Other robot class should inherit from this class.
Definition: RRBaseRobot.h:161