I’m trying to use the skeletal mesh weapon from the epic templates.
In your example template you use a Static Mesh Actor as a gun.
I tried to duplicate this code, however I think your AGrippableSkeletalMeshActor should never work.
At some point GripMotionControllerComponent.cpp calls this method:
bool UGripMotionControllerComponent::GripActor( AActor* ActorToGrip, ...
This method has this check:
root->Mobility != EComponentMobility::Movable
However the root is a Skeletal Mesh Component, which can never be Movable.
I tried setting it Moveable in my blueprint On Construct & BeginPlay (using Rama’s VictoryPlugin has a function for this).
Now that didn’t work, so instead I changed the check to: (did this for both GripActor methods)
bool isSkeletalMesh = root->IsA(USkeletalMeshComponent::StaticClass()) || root->IsA(ASkeletalMeshActor::StaticClass()); // Has to be movable to work. Skeletal Mesh can't be movable.
if (!isSkeletalMesh && root->Mobility != EComponentMobility::Movable)
UE_LOG(LogVRMotionController, Warning, TEXT("VRGripMotionController tried to grip an actor set to static mobility and bAllowSetMobility is false"));
return false; // It is not movable, can't grip it
I also modified the Weapon so that the Skeleton bones are exactly the same as the Static Gun.
In the new skeleton I added the VRGrip sockets. Next to that I created a new Physics asset.
The current status is that the hand now grips the BP Actor that contains the Skeletal Mesh Actor and fire’s the weapon, however the weapon location and rotation are never updated (even though all settings are exact the same as the Static Mesh Gun.
The fire does seem to work.
Note: The drop seems to work, since when the motion controller is moved away the weapon stops fireing.
Grab animations work. (hand open / closed animations are being applied when hovering or grabbed)
Drop works (kinda, the weapon physics don’t seem to be applied (it keeps floating where it spawn), but it stops firing when moving to far from the weapon).
Fire weapon start/stop works.
Location / Rotation do not work for Grippable Skeletal Mesh Actors.
Do you have an example using a Skeletal Mesh Weapon?
Where is the motion controller rotation/location applied to the grabbed actor?
Maybe there is another mobility check I missed.
I noticed GrippedBoneName, OptionalBoneToGripName and OptionalSnapToSocketName is always None for both Gripable Static / Skeletal Mesh Actors, however socketTrans seems to be set so I guess it’s not really a problem.
I’m currently using VR Example Plugin template of 16-03-2018 (f62d5b04063c091e809a4664d4b5d3c4eabd0d0d)