View on GitHub

ezEngine Documentation

The documentation for ezEngine

PhysX Grab Object Component

The PhysX grab object component enables a character controller to pick up physical items to carry around, drop or throw.

The component is typically attached to the same object as the camera component. When triggered, it uses a raycast along its X axis to determine which physical object to potentially pick up. When it finds a non-kinematic dynamic actor, it checks whether a grabbable item component is available. If so, the information from that component is used to determine the best anchor at which to hold the object, otherwise it uses the object’s bounding box to approximate a grab point.

When it finds a suitable grab point, it attaches a 6DOF joint to an object that is specified to be the pivot point (see AttachTo property). That object has to have a kinematic actor and a dummy shape. The joint will then pull the grabbed item towards it and try to align its orientation according to the grabbed anchor.

The grabbed item can then be dropped, or thrown away. All actions must be triggered from code, either C++ or TypeScript.

The grabbed item still physically interacts with the environment. If such collisions hold the object too far back, the grab object component may decide to ‘break’ the joint and drop the object. In this case a ezMsgPhysicsJointBroke event message is sent.

Component Properties

See Also