| 182 | } |
| 183 | |
| 184 | NpArticulationLink* createArticulationLink(PxArticulationBase&root, NpArticulationLink* parent, const PxTransform& pose) |
| 185 | { |
| 186 | PX_CHECK_AND_RETURN_NULL(pose.isValid(),"Supplied PxArticulation pose is not valid. Articulation link creation method returns NULL."); |
| 187 | PX_CHECK_AND_RETURN_NULL((!parent || (&parent->getRoot() == &root)), "specified parent link is not part of the destination articulation. Articulation link creation method returns NULL."); |
| 188 | |
| 189 | NpArticulationLink* npArticulationLink = NpFactory::getInstance().createNpArticulationLink(root, parent, pose); |
| 190 | if (!npArticulationLink) |
| 191 | { |
| 192 | Ps::getFoundation().error(PxErrorCode::eINTERNAL_ERROR, __FILE__, __LINE__, |
| 193 | "Articulation link initialization failed: returned NULL."); |
| 194 | return NULL; |
| 195 | } |
| 196 | |
| 197 | if (parent) |
| 198 | { |
| 199 | PxTransform parentPose = parent->getCMassLocalPose().transformInv(pose); |
| 200 | PxTransform childPose = PxTransform(PxIdentity); |
| 201 | |
| 202 | PxArticulationJointBase* npArticulationJoint = root.createArticulationJoint(*parent, parentPose, *npArticulationLink, childPose); |
| 203 | if (!npArticulationJoint) |
| 204 | { |
| 205 | PX_DELETE(npArticulationLink); |
| 206 | |
| 207 | Ps::getFoundation().error(PxErrorCode::eINTERNAL_ERROR, __FILE__, __LINE__, |
| 208 | "Articulation link initialization failed due to joint creation failure: returned NULL."); |
| 209 | return NULL; |
| 210 | } |
| 211 | |
| 212 | npArticulationLink->setInboundJoint(*npArticulationJoint); |
| 213 | } |
| 214 | |
| 215 | return npArticulationLink; |
| 216 | } |
| 217 | |
| 218 | // pointers to functions above, initialized during subsystem registration |
| 219 | static PxArticulationBase* (*sCreateArticulationFn)() = 0; |
nothing calls this directly
no test coverage detected