I’m working on a VR project based on the VR template, where the player can pick up a weapon and attach items to the weapon while it’s being held. It’s also possible to attach items to the weapon even if it’s not being held in the hand. If the player attempts to attach an item to the weapon while holding the weapon, a collision bug occurs once the weapon is dropped. I was able to reproduce the error in a separate test project I created to isolate the behavior. A link to the project is included below.
Steps to reproduce:
- Open the included project in Unreal Engine 4.13: AttachTest.zip
- Select “Play this level in VR”.
- Teleport over to table with objects and pick up the gun by grabbing the pistol grip.
- Grab a magazine and insert the non-flared end into the magazine well. The magazine will automatically attach to gun prior to entering the magazine well.
- Drop the gun onto the table so that the magazine will hit first.
Depending on the orientation of the gun when it is dropped, it should immediately experience unexpected physics behavior. Further testing revealed that the collision for the attached magazine is somehow decoupling from the magazine and remaining frozen in space. Using other physics objects in the scene, I am able to locate the invisible collision hull, which otherwise remains invisible even when using the “show collision” command in the console during play.
Steps to reproduce:
- Open the included project in Unreal Engine 4.13: AttachTest.zip
- Select “Play this level in VR”.
- Teleport over to table with objects and pick up the gun by grabbing the pistol grip.
- Grab a magazine and insert the non-flared end into the magazine well. The magazine will automatically attach to gun prior to entering the magazine well.
- Orient the gun so that it is horizontal, with the magazine pointing roughly toward the stack of blue boxes. This positioning helps ensure the gun lands on the table in a predictable fashion for the next step.
- Drop the gun onto the table so that it must fall a short distance before landing on the table. Line the magazine up with the square tiles on the table to make it easier to locate the invisible collision volume in the next step.
- Grab another magazine and orient it so that it is horizontal and a short distance above where the magazine was before the gun was dropped.
- If dropped from the correct location, the magazine will land on the stationary collision volume that was originally part of the attached magazine.
- While using the trigger to ball up the fist, push the gun around. The gun will respond to force applied by the fist, but the attached magazine will not.
- Pick up the gun by grabbing the pistol grip. The stationary collision volume will vanish, causing the second magazine to drop to the table. The collision volume will return to the attached magazine, and will push other objects out of the way if the gun is moved so that the magazine collides with other physics objects.
- At this point, steps 5-10 can be repeated without any change in behavior.
This behavior only manifests itself if the the gun is being held when the magazine is attached. If the gun is sitting on the table when a magazine is attached, behavior for the most part is as expected.
Steps to reproduce:
- Open the included project in Unreal Engine 4.13: AttachTest.zip
- Select “Play this level in VR”.
- Teleport over to table with objects and pick up a magazine.
- Insert the non-flared end into the magazine well into the gun as it rests on the table. The magazine will automatically attach to gun prior to entering the magazine well.
- Ball up the fist and attempt to push the gun around by pushing at the gun itself and then at the attached magazine. There do appear to be some physics quirks, but otherwise the gun and attach magazine move as expected.
- With a magazine already attached to the gun, pick up the gun by its pistol grip.
- Move the gun around so that the attached magazine collides with other physics objects. They should move out of the way as expected.
- Drop the gun while the magazine is attached.
- At this point, steps 5-8 can be repeated without any change in behavior.
The only difference I can see between the two scenarios is that physics seem to have a problem only if physics simulation is NOT enabled at the time the magazine is attached (due to the gun being attached to the player’s hand.) If physics simulation is enabled at the time the magazine is attached, then the problem does not occur. I tried a workaround that involved detaching the gun from the player’s hand just before the magazine attaches, but that seemed to cause other unpredictable behavior if done multiple times in a row with 4.13. I cannot recreate the project in 4.14 at this time due to a known bug involving the importing of skeletal meshes that is scheduled to be fixed in 4.14.1. I tried opening the existing project to 4.14, but the error manifests itself in a more unpredictable manner.
Let me know if you need any further info…