[C++/VR] Prevent clipping on pick up object
As I understand it, physics constraints are the ideal way to attach a pick-up to a VR controller (Actor) while retaining the inability for the player to make the picked up object from clipping through walls. However when I try to set a constraint to the controller actor, the mesh will not move at all with the controller.
Current code/setup is as follows:
AStaticMeshActor with UPhysicsConstraintComponent and PickUpAble Tag
AVRController Class derived from AActor
I have tried reversing the Actors in the SetConstrainedComponents and the behavior is the same.
Here is a video of the not desired output https://www.youtube.com/watch?v=0bwknAvh-Us
After a day of testing and looking at other people's code I was able to get the desired effect.
I needed to constrain the two static meshes with m_pick_up_actor->m_phys_constraint->SetConstrainedComponents(m_vr_controller_mesh, NAME_None, m_pick_up_actor->GetStaticMeshComponent(), NAME_None);
I also had to set the following properties on the constraint Stiffness 5000 Damping 500 Contact 10 LinearBreakThreshold 5000000
I also had to disable and enable the LinearBreakThreshold when teleporting. Here is a video of how it looks https://www.youtube.com/watch?v=-YQaTvI5LOY
answered Dec 10 '18 at 08:14 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here