Gurrier
18-05-2010 17:31:16
I really need some help here, totally in the dark. It more a python know how problem.
This is the code for making a distanceJoint with PhysX:
This is what I made from it:
Everything fills in oke but on the line "distJoint = self.gScene.createJoint(distDesc)" I get this error:
If I then try to change:
Some help would greatly be apreciated!
tkx in advance
the solution code:
This is the code for making a distanceJoint with PhysX:
NxDistanceJointDesc distDesc;
distDesc.actor[0] = actor0;
distDesc.actor[1] = actor1;
distDesc.localAnchor[0]=NxVec(0.0f,1.0f,0.0f); //point which is constrained on actor0
distDesc.localAnchor[1]=NxVec(1.0f,0.0f,0.0f); //point which is constrained in actor1
distDesc.maxDistance=10.0f;
distDesc.minDistance=10.0f;
distDesc.flags=NX_DJF_MIN_DISTANCE_ENABLED | NX_DJF_MAX_DISTANCE_ENABLED; //Enforce a fixed distance.
NxDistanceJoint* distJoint=(NxDistanceJoint *)gScene->createJoint(distDesc);
This is what I made from it:
##Make the joint
distDesc = physx.NxDistanceJointDesc
##set up actors
actors = actor0, actor1
distDesc.actor = actors
##setup the correct local anchor points
anchors = anchor0, anchor1
distDesc.localAnchor = anchors
##setup the max and min distance
distDesc.maxDistance = maxDist
distDesc.minDistance = minDist
distDesc.flags = physx.NX_DJF_MIN_DISTANCE_ENABLED | physx.NX_DJF_MAX_DISTANCE_ENABLED
distJoint = self.gScene.createJoint(distDesc)
Everything fills in oke but on the line "distJoint = self.gScene.createJoint(distDesc)" I get this error:
distJoint = self.gScene.createJoint(distDesc)
Boost.Python.ArgumentError: Python argument types in
NxScene.createJoint(NxScene, Boost.Python.class)
did not match C++ signature:
createJoint(struct NxScene_wrapper {lvalue}, class NxJointDesc)
createJoint(class NxScene {lvalue}, class NxJointDesc jointDesc)
If I then try to change:
distDesc = physx.NxDistanceJointDesc
to
distDesc = physx.NxDistanceJointDesc() ##note the ()
I get an error at
distDesc.actor = actors
AttributeError: can't set attribute
Some help would greatly be apreciated!
tkx in advance
the solution code:
##Make the joint
distDesc = physx.NxDistanceJointDesc()
##set up actors
actors = actor0, actor1
distDesc.actor[0] = actor0
distDesc.actor[1] = actor1
##setup the correct local anchor points
anchors = anchor0, anchor1
distDesc.localAnchor[0] = anchor0
distDesc.localAnchor[1] = anchor1
##setup the max and min distance
distDesc.maxDistance = maxDist
distDesc.minDistance = minDist
distDesc.flags = physx.NX_DJF_MIN_DISTANCE_ENABLED | physx.NX_DJF_MAX_DISTANCE_ENABLED
if canCollide:
distDesc.flags |= physx.NX_JF_COLLISION_ENABLED
if visualize:
distDesc.flags |= physx.NX_JF_VISUALIZATION
distJoint = self.gScene.createJoint(distDesc)