enable bGravityEnabled, bSimulatePhysics, and call WakeRigidBody on grab component's owning actor at BeginPlay() if bAffectPhysicsState is enabled

This commit is contained in:
Mamadou Babaei
2024-08-16 18:01:08 +02:00
parent 3cef149d4f
commit 5f81430677
3 changed files with 30 additions and 0 deletions
+2
View File
@@ -73,6 +73,7 @@ This is a minor release focusing mainly on bringing OpenXR-compatible hand track
### Fixed
- Fixed a bug when the virtual hand inside the game is not visible but still collides with other objects inside the scene, mistakenly triggering events like OnGrabStateUpdated and OnTouchStateUpdated.
- Fixed a bug where USGGrabComponent's `bAffectPhysicsState` does not enables physics on its owning actor at `BeginPlay()`.
- Fixed various wrong Kismet script names and their class exports.
- Fixed the display name for various overloads of the Blueprint-exposed function `Queue Command Vibro Level` to expose sensible display names.
- Some Android UPL tweaks, permission, and build fixes.
@@ -95,6 +96,7 @@ This is a minor release focusing mainly on bringing OpenXR-compatible hand track
- FSGDebugVirtualHand::Draw now accepts a FXRMotionControllerData parameter instead of all WristLocation, WristRotation, JointPositions, and JointRotations parameters.
- FSGDebugVirtualHandSettings has been renamed to FSGVirtualHandDebuggingSettings.
- The value for USGGrabComponent's AttachmentSocketName uproperty now defaults to the value of the plugin's GrabAttachPointSocketName instead of Name_NONE.
- The USGGrabComponent now enables `bGravityEnabled`, `bSimulatePhysics`, and calls `WakeRigidBody` on its owning actor at `BeginPlay()` if `bAffectPhysicsState` is enabled.
- Updated the Directory Structure section of the main README file to reflect the latest toolchain support status.
- The `/CHANGELOG.md` file has been migrated to `/Handbook/src/overview/changelog.md`
- The `/LICENSE.md` file has been migrated to `/Handbook/src/license/senseglove-unreal-engine-plugin.md`
@@ -135,4 +135,29 @@ USGGrabComponent::FImpl::~FImpl() = default;
void USGGrabComponent::FImplDeleter::operator()(const FImpl* P) const
{
delete P;
}
void USGGrabComponent::BeginPlay()
{
Super::BeginPlay();
if (bAffectPhysicsState)
{
const AActor* OwnerActor{GetOwner()};
if (!ensureAlwaysMsgf(IsValid(OwnerActor), TEXT("Invalid OwnerActor!")))
{
return;
}
UPrimitiveComponent* ActorRootComponent{Cast<UPrimitiveComponent>(OwnerActor->GetRootComponent())};
if (!ensureAlwaysMsgf(IsValid(ActorRootComponent),
TEXT("RootComponent is not a valid UPrimativeComponent!")))
{
return;
}
ActorRootComponent->SetEnableGravity(true);
ActorRootComponent->SetSimulatePhysics(true);
ActorRootComponent->WakeRigidBody();
}
}
@@ -196,4 +196,7 @@ public:
{
bAffectPhysicsState = bInAffectPhysicsState;
}
public:
virtual void BeginPlay() override;
};