MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/PhysX / setActors

Method setActors

physx/source/physx/src/NpConstraint.cpp:171–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

169}
170
171void NpConstraint::setActors(PxRigidActor* actor0, PxRigidActor* actor1)
172{
173 NP_WRITE_CHECK(getNpScene());
174
175 PX_CHECK_AND_RETURN((actor0 && !actor0->is<PxRigidStatic>()) || (actor1 && !actor1->is<PxRigidStatic>()), "PxConstraint: at least one actor must be non-static");
176 PX_SIMD_GUARD;
177
178 if(mActor0)
179 NpActor::getFromPxActor(*mActor0).removeConnector(*mActor0, NpConnectorType::eConstraint, this, "PxConstraint: Add to rigid actor 0: Constraint already added");
180 if(mActor1)
181 NpActor::getFromPxActor(*mActor1).removeConnector(*mActor1, NpConnectorType::eConstraint, this, "PxConstraint: Add to rigid actor 1: Constraint already added");
182
183 if(actor0)
184 NpActor::getFromPxActor(*actor0).addConnector(NpConnectorType::eConstraint, this, "PxConstraint: Add to rigid actor 0: Constraint already added");
185 if(actor1)
186 NpActor::getFromPxActor(*actor1).addConnector(NpConnectorType::eConstraint, this, "PxConstraint: Add to rigid actor 1: Constraint already added");
187
188 mActor0 = actor0;
189 mActor1 = actor1;
190
191 NpScene* newScene = getSceneFromActors(actor0, actor1);
192 NpScene* oldScene = getNpScene();
193
194 if (oldScene != newScene)
195 {
196 if (oldScene)
197 {
198 oldScene->removeFromConstraintList(*this);
199 oldScene->getScene().removeConstraint(getScbConstraint());
200 }
201
202 getScbConstraint().setBodies(getScbRigidObject(actor0), getScbRigidObject(actor1));
203
204 if (newScene)
205 {
206 newScene->addToConstraintList(*this);
207 newScene->getScene().addConstraint(getScbConstraint());
208 }
209 }
210 else
211 getScbConstraint().setBodies(getScbRigidObject(actor0), getScbRigidObject(actor1));
212}
213
214void NpConstraint::markDirty()
215{

Callers 2

setPxConstraint_ActorsFunction · 0.45
setPxJoint_ActorsFunction · 0.45

Calls 9

getNpSceneFunction · 0.85
removeConnectorMethod · 0.80
addConnectorMethod · 0.80
addToConstraintListMethod · 0.80
removeConstraintMethod · 0.45
getSceneMethod · 0.45
setBodiesMethod · 0.45
addConstraintMethod · 0.45

Tested by

no test coverage detected