public PxMat33(PxQuat q) : this(physxPINVOKE.new_PxMat33__SWIG_6(PxQuat.getCPtr(q)), true) { if (physxPINVOKE.SWIGPendingException.Pending) { throw physxPINVOKE.SWIGPendingException.Retrieve(); } }
static void createKinematics() { const uint NbX = NB_KINE_X; const uint NbY = NB_KINE_Y; PxVec3 dims = new(1.5f, 0.2f, 1.5f); PxQuat rot = new PxQuat(PxIdentity); const float YScale = 0.4f; PxShape *shape = gPhysics->createShape(new PxBoxGeometry(dims), *gMaterial, false, PxShapeFlags.eVISUALIZATION | PxShapeFlags.eSCENE_QUERY_SHAPE | PxShapeFlags.eSIMULATION_SHAPE); //BIOQUIRK: Missing default arguments const float ScaleX = KINE_SCALE; const float ScaleY = KINE_SCALE; for (uint y = 0; y < NbY; y++) { for (uint x = 0; x < NbX; x++) { float xf = ((float)(x) - (float)(NbX) * 0.5f) * ScaleX; float yf = ((float)(y) - (float)(NbY) * 0.5f) * ScaleY; PxTransform pose = new(new PxVec3(xf, 0.2f + YScale, yf), rot); PxRigidDynamic *body = gPhysics->createRigidDynamic(pose); body->attachShape(ref *shape); gScene->addActor(ref *body); body->setRigidBodyFlag(PxRigidBodyFlags.eKINEMATIC, true); gKinematics[y, x] = body; } } }
public PxTransform(PxQuat orientation) : this(physxPINVOKE.new_PxTransform__SWIG_3(PxQuat.getCPtr(orientation)), true) { if (physxPINVOKE.SWIGPendingException.Pending) { throw physxPINVOKE.SWIGPendingException.Retrieve(); } }
public PxTransform(float x, float y, float z, PxQuat aQ) : this(physxPINVOKE.new_PxTransform__SWIG_4(x, y, z, PxQuat.getCPtr(aQ)), true) { if (physxPINVOKE.SWIGPendingException.Pending) { throw physxPINVOKE.SWIGPendingException.Retrieve(); } }
public PxQuat(PxQuat v) : this(physxPINVOKE.new_PxQuat__SWIG_5(PxQuat.getCPtr(v)), true) { if (physxPINVOKE.SWIGPendingException.Pending) { throw physxPINVOKE.SWIGPendingException.Retrieve(); } }
public PxTransform(PxVec3 p0, PxQuat q0) : this(physxPINVOKE.new_PxTransform__SWIG_6(PxVec3.getCPtr(p0), PxQuat.getCPtr(q0)), true) { if (physxPINVOKE.SWIGPendingException.Pending) { throw physxPINVOKE.SWIGPendingException.Retrieve(); } }
public virtual void setTargetOrientation(PxQuat orientation) { physxPINVOKE.PxArticulationJoint_setTargetOrientation(swigCPtr, PxQuat.getCPtr(orientation)); if (physxPINVOKE.SWIGPendingException.Pending) { throw physxPINVOKE.SWIGPendingException.Retrieve(); } }
public float dot(PxQuat v) { float ret = physxPINVOKE.PxQuat_dot(swigCPtr, PxQuat.getCPtr(v)); if (physxPINVOKE.SWIGPendingException.Pending) { throw physxPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public float getAngle(PxQuat q) { float ret = physxPINVOKE.PxQuat_getAngle__SWIG_1(swigCPtr, PxQuat.getCPtr(q)); if (physxPINVOKE.SWIGPendingException.Pending) { throw physxPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
static void createDynamics() { const uint NbX = 8; const uint NbY = 8; PxVec3 dims = new(0.2f, 0.1f, 0.2f); const float sphereRadius = 0.2f; const float capsuleRadius = 0.2f; const float halfHeight = 0.5f; const uint NbLayers = 3; const float YScale = 0.4f; const float YStart = 6.0f; PxShape * boxShape = gPhysics->createShape(new PxBoxGeometry(dims), *gMaterial, false, PxShapeFlags.eVISUALIZATION | PxShapeFlags.eSCENE_QUERY_SHAPE | PxShapeFlags.eSIMULATION_SHAPE); //BIOQUIRK: Missing default arguments PxShape *sphereShape = gPhysics->createShape(new PxSphereGeometry(sphereRadius), *gMaterial, false, PxShapeFlags.eVISUALIZATION | PxShapeFlags.eSCENE_QUERY_SHAPE | PxShapeFlags.eSIMULATION_SHAPE); //BIOQUIRK: Missing default arguments PxShape *capsuleShape = gPhysics->createShape(new PxCapsuleGeometry(capsuleRadius, halfHeight), *gMaterial, false, PxShapeFlags.eVISUALIZATION | PxShapeFlags.eSCENE_QUERY_SHAPE | PxShapeFlags.eSIMULATION_SHAPE); //BIOQUIRK: Missing default arguments PxMat33 m; for (uint j = 0; j < NbLayers; j++) { float angle = (float)j * 0.08f; PxQuat rot = setRotY(out m, angle); const float ScaleX = 4.0f; const float ScaleY = 4.0f; for (uint y = 0; y < NbY; y++) { for (uint x = 0; x < NbX; x++) { float xf = ((float)(x) - (float)(NbX) * 0.5f) * ScaleX; float yf = ((float)(y) - (float)(NbY) * 0.5f) * ScaleY; PxRigidDynamic *dynamic = null; uint v = j & 3; PxVec3 pos = new PxVec3(xf, YStart + (float)(j) * YScale, yf); switch (v) { case 0: { PxTransform pose = new(pos, rot); dynamic = gPhysics->createRigidDynamic(pose); dynamic->attachShape(ref *boxShape); break; } case 1: { PxTransform pose = new(pos, new PxQuat(PxIdentity)); dynamic = gPhysics->createRigidDynamic(pose); dynamic->attachShape(ref *sphereShape); break; } default: { PxTransform pose = new(pos, rot); dynamic = gPhysics->createRigidDynamic(pose); dynamic->attachShape(ref *capsuleShape); break; } } ; PxRigidBodyExt.updateMassAndInertia(ref *dynamic, 10f); gScene->addActor(ref *dynamic); } } } }
static void createScissorLift() { const float runnerLength = 2f; const float placementDistance = 1.8f; const float cosAng = (placementDistance) / (runnerLength); float angle = PxAcos(cosAng); float sinAng = PxSin(angle); PxQuat leftRot = new(-angle, new PxVec3(1f, 0f, 0f)); PxQuat rightRot = new(angle, new PxVec3(1f, 0f, 0f)); //(1) Create base... PxArticulationLink * @base = gArticulation->createLink(null, new PxTransform(new PxVec3(0f, 0.25f, 0f))); const PxShapeFlags defaultShapeFlags = PxShapeFlags.eVISUALIZATION | PxShapeFlags.eSCENE_QUERY_SHAPE | PxShapeFlags.eSIMULATION_SHAPE; //BIOQUIRK: Many missing defaults PxRigidActorExt.createExclusiveShape(ref *@base, new PxBoxGeometry(0.5f, 0.25f, 1.5f), *gMaterial, defaultShapeFlags); PxRigidBodyExt.updateMassAndInertia(ref *@base, 3f); //Now create the slider and fixed joints... gArticulation->setSolverIterationCounts(32); PxArticulationLink *leftRoot = gArticulation->createLink(@base, new PxTransform(new PxVec3(0f, 0.55f, -0.9f))); PxRigidActorExt.createExclusiveShape(ref *leftRoot, new PxBoxGeometry(0.5f, 0.05f, 0.05f), *gMaterial, defaultShapeFlags); PxRigidBodyExt.updateMassAndInertia(ref *leftRoot, 1f); PxArticulationLink *rightRoot = gArticulation->createLink(@base, new PxTransform(new PxVec3(0f, 0.55f, 0.9f))); PxRigidActorExt.createExclusiveShape(ref *rightRoot, new PxBoxGeometry(0.5f, 0.05f, 0.05f), *gMaterial, defaultShapeFlags); PxRigidBodyExt.updateMassAndInertia(ref *rightRoot, 1f); PxArticulationJointReducedCoordinate *joint = static_cast <PxArticulationJointReducedCoordinate>(leftRoot->getInboundJoint()); joint->setJointType(PxArticulationJointType.eFIX); joint->setParentPose(new PxTransform(new PxVec3(0f, 0.25f, -0.9f))); joint->setChildPose(new PxTransform(new PxVec3(0f, -0.05f, 0f))); //Set up the drive joint... gDriveJoint = static_cast <PxArticulationJointReducedCoordinate>(rightRoot->getInboundJoint()); gDriveJoint->setJointType(PxArticulationJointType.ePRISMATIC); gDriveJoint->setMotion(PxArticulationAxis.eZ, PxArticulationMotions.eLIMITED); gDriveJoint->setLimit(PxArticulationAxis.eZ, -1.4f, 0.2f); gDriveJoint->setDrive(PxArticulationAxis.eZ, 100000f, 0f, float.MaxValue); gDriveJoint->setParentPose(new PxTransform(new PxVec3(0f, 0.25f, 0.9f))); gDriveJoint->setChildPose(new PxTransform(new PxVec3(0f, -0.05f, 0f))); const uint linkHeight = 3; PxArticulationLink *currLeft = leftRoot, currRight = rightRoot; PxQuat rightParentRot = new(PxIdentity); PxQuat leftParentRot = new(PxIdentity); for (uint i = 0; i < linkHeight; ++i) { PxVec3 pos = new(0.5f, 0.55f + 0.1f * (1 + i), 0f); PxArticulationLink *leftLink = gArticulation->createLink(currLeft, new PxTransform(pos.operator_Plus(new PxVec3(0f, sinAng * (2 * i + 1), 0f)), leftRot)); //BIOQUIRK: Operator overload PxRigidActorExt.createExclusiveShape(ref *leftLink, new PxBoxGeometry(0.05f, 0.05f, 1f), *gMaterial, defaultShapeFlags); PxRigidBodyExt.updateMassAndInertia(ref *leftLink, 1f); PxVec3 leftAnchorLocation = pos.operator_Plus(new PxVec3(0f, sinAng * (2 * i), -0.9f)); //BIOQUIRK: Operator overload joint = static_cast <PxArticulationJointReducedCoordinate>(leftLink->getInboundJoint()); joint->setParentPose(new PxTransform(currLeft->getGlobalPose().transformInv(leftAnchorLocation), leftParentRot)); joint->setChildPose(new PxTransform(new PxVec3(0f, 0f, -1f), rightRot)); joint->setJointType(PxArticulationJointType.eREVOLUTE); leftParentRot = leftRot; joint->setMotion(PxArticulationAxis.eTWIST, PxArticulationMotions.eLIMITED); joint->setLimit(PxArticulationAxis.eTWIST, -MathF.PI, angle); PxArticulationLink *rightLink = gArticulation->createLink(currRight, new PxTransform(pos.operator_Plus(new PxVec3(0f, sinAng * (2 * i + 1), 0f)), rightRot)); //BIOQUIRK: Operator overload PxRigidActorExt.createExclusiveShape(ref *rightLink, new PxBoxGeometry(0.05f, 0.05f, 1f), *gMaterial, defaultShapeFlags); PxRigidBodyExt.updateMassAndInertia(ref *rightLink, 1f); PxVec3 rightAnchorLocation = pos.operator_Plus(new PxVec3(0f, sinAng * (2 * i), 0.9f)); //BIOQUIRK: Operator overload joint = static_cast <PxArticulationJointReducedCoordinate>(rightLink->getInboundJoint()); joint->setJointType(PxArticulationJointType.eREVOLUTE); joint->setParentPose(new PxTransform(currRight->getGlobalPose().transformInv(rightAnchorLocation), rightParentRot)); joint->setChildPose(new PxTransform(new PxVec3(0f, 0f, 1f), leftRot)); joint->setMotion(PxArticulationAxis.eTWIST, PxArticulationMotions.eLIMITED); joint->setLimit(PxArticulationAxis.eTWIST, -angle, MathF.PI); rightParentRot = rightRot; PxD6Joint *d6joint = PxD6JointCreate(ref *gPhysics, leftLink, new PxTransform(PxIdentity), rightLink, new PxTransform(PxIdentity)); d6joint->setMotion(PxD6Axis.eTWIST, PxD6Motion.eFREE); d6joint->setMotion(PxD6Axis.eSWING2, PxD6Motion.eFREE); d6joint->setMotion(PxD6Axis.eSWING1, PxD6Motion.eFREE); currLeft = rightLink; currRight = leftLink; } PxArticulationLink *leftTop = gArticulation->createLink(currLeft, currLeft->getGlobalPose().transform(new PxTransform(new PxVec3(-0.5f, 0f, -1.0f), leftParentRot))); PxRigidActorExt.createExclusiveShape(ref *leftTop, new PxBoxGeometry(0.5f, 0.05f, 0.05f), *gMaterial, defaultShapeFlags); PxRigidBodyExt.updateMassAndInertia(ref *leftTop, 1f); PxArticulationLink *rightTop = gArticulation->createLink(currRight, currRight->getGlobalPose().transform(new PxTransform(new PxVec3(-0.5f, 0f, 1.0f), rightParentRot))); PxRigidActorExt.createExclusiveShape(ref *rightTop, new PxCapsuleGeometry(0.05f, 0.8f), *gMaterial, defaultShapeFlags); //PxRigidActorExt.createExclusiveShape(ref *rightTop, PxBoxGeometry(0.5f, 0.05f, 0.05f), *gMaterial, defaultShapeFlags); PxRigidBodyExt.updateMassAndInertia(ref *rightTop, 1f); joint = static_cast <PxArticulationJointReducedCoordinate>(leftTop->getInboundJoint()); joint->setParentPose(new PxTransform(new PxVec3(0f, 0f, -1f), currLeft->getGlobalPose().q.getConjugate())); joint->setChildPose(new PxTransform(new PxVec3(0.5f, 0f, 0f), leftTop->getGlobalPose().q.getConjugate())); joint->setJointType(PxArticulationJointType.eREVOLUTE); joint->setMotion(PxArticulationAxis.eTWIST, PxArticulationMotions.eFREE); //joint->setDrive(PxArticulationAxis.eTWIST, 0f, 10f, float.MaxValue); joint = static_cast <PxArticulationJointReducedCoordinate>(rightTop->getInboundJoint()); joint->setParentPose(new PxTransform(new PxVec3(0f, 0f, 1f), currRight->getGlobalPose().q.getConjugate())); joint->setChildPose(new PxTransform(new PxVec3(0.5f, 0f, 0f), rightTop->getGlobalPose().q.getConjugate())); joint->setJointType(PxArticulationJointType.eREVOLUTE); joint->setMotion(PxArticulationAxis.eTWIST, PxArticulationMotions.eFREE); //joint->setDrive(PxArticulationAxis.eTWIST, 0f, 10f, float.MaxValue); currLeft = leftRoot; currRight = rightRoot; rightParentRot = new PxQuat(PxIdentity); leftParentRot = new PxQuat(PxIdentity); for (uint i = 0; i < linkHeight; ++i) { PxVec3 pos = new(-0.5f, 0.55f + 0.1f * (1 + i), 0f); PxArticulationLink *leftLink = gArticulation->createLink(currLeft, new PxTransform(pos.operator_Plus(new PxVec3(0f, sinAng * (2 * i + 1), 0f)), leftRot)); //BIOQURK: Operator overload PxRigidActorExt.createExclusiveShape(ref *leftLink, new PxBoxGeometry(0.05f, 0.05f, 1f), *gMaterial, defaultShapeFlags); PxRigidBodyExt.updateMassAndInertia(ref *leftLink, 1f); PxVec3 leftAnchorLocation = pos.operator_Plus(new PxVec3(0f, sinAng * (2 * i), -0.9f)); //BIOQUIRK: Operator overload joint = static_cast <PxArticulationJointReducedCoordinate>(leftLink->getInboundJoint()); joint->setJointType(PxArticulationJointType.eREVOLUTE); joint->setParentPose(new PxTransform(currLeft->getGlobalPose().transformInv(leftAnchorLocation), leftParentRot)); joint->setChildPose(new PxTransform(new PxVec3(0f, 0f, -1f), rightRot)); leftParentRot = leftRot; joint->setMotion(PxArticulationAxis.eTWIST, PxArticulationMotions.eLIMITED); joint->setLimit(PxArticulationAxis.eTWIST, -float.MaxValue, angle); PxArticulationLink *rightLink = gArticulation->createLink(currRight, new PxTransform(pos.operator_Plus(new PxVec3(0f, sinAng * (2 * i + 1), 0f)), rightRot)); //BIOQUIRK: Operator overload PxRigidActorExt.createExclusiveShape(ref *rightLink, new PxBoxGeometry(0.05f, 0.05f, 1f), *gMaterial, defaultShapeFlags); PxRigidBodyExt.updateMassAndInertia(ref *rightLink, 1f); PxVec3 rightAnchorLocation = pos.operator_Plus(new PxVec3(0f, sinAng * (2 * i), 0.9f)); //BIOQUIRK: Operator overload /*joint = PxD6JointCreate(ref *getPhysics(), currRight, new PxTransform(currRight->getGlobalPose().transformInv(rightAnchorLocation)), * rightLink, new PxTransform(new PxVec3(0f, 0f, 1f)));*/ joint = static_cast <PxArticulationJointReducedCoordinate>(rightLink->getInboundJoint()); joint->setParentPose(new PxTransform(currRight->getGlobalPose().transformInv(rightAnchorLocation), rightParentRot)); joint->setJointType(PxArticulationJointType.eREVOLUTE); joint->setChildPose(new PxTransform(new PxVec3(0f, 0f, 1f), leftRot)); joint->setMotion(PxArticulationAxis.eTWIST, PxArticulationMotions.eLIMITED); joint->setLimit(PxArticulationAxis.eTWIST, -angle, float.MaxValue); rightParentRot = rightRot; PxD6Joint *d6joint = PxD6JointCreate(ref *gPhysics, leftLink, new PxTransform(PxIdentity), rightLink, new PxTransform(PxIdentity)); d6joint->setMotion(PxD6Axis.eTWIST, PxD6Motion.eFREE); d6joint->setMotion(PxD6Axis.eSWING1, PxD6Motion.eFREE); d6joint->setMotion(PxD6Axis.eSWING2, PxD6Motion.eFREE); currLeft = rightLink; currRight = leftLink; } { PxD6Joint *d6joint = PxD6JointCreate(ref *gPhysics, currLeft, new PxTransform(new PxVec3(0f, 0f, -1f)), leftTop, new PxTransform(new PxVec3(-0.5f, 0f, 0f))); d6joint->setMotion(PxD6Axis.eTWIST, PxD6Motion.eFREE); d6joint->setMotion(PxD6Axis.eSWING1, PxD6Motion.eFREE); d6joint->setMotion(PxD6Axis.eSWING2, PxD6Motion.eFREE); d6joint = PxD6JointCreate(ref *gPhysics, currRight, new PxTransform(new PxVec3(0f, 0f, 1f)), rightTop, new PxTransform(new PxVec3(-0.5f, 0f, 0f))); d6joint->setMotion(PxD6Axis.eTWIST, PxD6Motion.eFREE); d6joint->setMotion(PxD6Axis.eSWING1, PxD6Motion.eFREE); d6joint->setMotion(PxD6Axis.eSWING2, PxD6Motion.eFREE); } PxTransform topPose = new(new PxVec3(0f, leftTop->getGlobalPose().p.y + 0.15f, 0f)); PxArticulationLink *top = gArticulation->createLink(leftTop, topPose); PxRigidActorExt.createExclusiveShape(ref *top, new PxBoxGeometry(0.5f, 0.1f, 1.5f), *gMaterial, defaultShapeFlags); PxRigidBodyExt.updateMassAndInertia(ref *top, 1f); joint = static_cast <PxArticulationJointReducedCoordinate>(top->getInboundJoint()); joint->setJointType(PxArticulationJointType.eFIX); joint->setParentPose(new PxTransform(new PxVec3(0f, 0.0f, 0f))); joint->setChildPose(new PxTransform(new PxVec3(0f, -0.15f, -0.9f))); gScene->addArticulation(ref *gArticulation); for (uint i = 0; i < gArticulation->getNbLinks(); ++i) { PxArticulationLink *link; gArticulation->getLinks(&link, 1, i); link->setLinearDamping(0.2f); link->setAngularDamping(0.2f); link->setMaxAngularVelocity(20f); link->setMaxLinearVelocity(100f); if (link != top) { for (uint b = 0; b < link->getNbShapes(); ++b) { PxShape *shape; link->getShapes(&shape, 1, b); shape->setSimulationFilterData(new PxFilterData(0, 0, 1, 0)); } } } PxVec3 halfExt = new(0.25f); const float density = 0.5f; PxRigidDynamic *box0 = gPhysics->createRigidDynamic(new PxTransform(new PxVec3(-0.25f, 5f, 0.5f))); PxRigidActorExt.createExclusiveShape(ref *box0, new PxBoxGeometry(halfExt), *gMaterial, defaultShapeFlags); PxRigidBodyExt.updateMassAndInertia(ref *box0, density); gScene->addActor(ref *box0); PxRigidDynamic *box1 = gPhysics->createRigidDynamic(new PxTransform(new PxVec3(0.25f, 5f, 0.5f))); PxRigidActorExt.createExclusiveShape(ref *box1, new PxBoxGeometry(halfExt), *gMaterial, defaultShapeFlags); PxRigidBodyExt.updateMassAndInertia(ref *box1, density); gScene->addActor(ref *box1); PxRigidDynamic *box2 = gPhysics->createRigidDynamic(new PxTransform(new PxVec3(-0.25f, 4.5f, 0.5f))); PxRigidActorExt.createExclusiveShape(ref *box2, new PxBoxGeometry(halfExt), *gMaterial, defaultShapeFlags); PxRigidBodyExt.updateMassAndInertia(ref *box2, density); gScene->addActor(ref *box2); PxRigidDynamic *box3 = gPhysics->createRigidDynamic(new PxTransform(new PxVec3(0.25f, 4.5f, 0.5f))); PxRigidActorExt.createExclusiveShape(ref *box3, new PxBoxGeometry(halfExt), *gMaterial, defaultShapeFlags); PxRigidBodyExt.updateMassAndInertia(ref *box3, density); gScene->addActor(ref *box3); PxRigidDynamic *box4 = gPhysics->createRigidDynamic(new PxTransform(new PxVec3(-0.25f, 5f, 0f))); PxRigidActorExt.createExclusiveShape(ref *box4, new PxBoxGeometry(halfExt), *gMaterial, defaultShapeFlags); PxRigidBodyExt.updateMassAndInertia(ref *box4, density); gScene->addActor(ref *box4); PxRigidDynamic *box5 = gPhysics->createRigidDynamic(new PxTransform(new PxVec3(0.25f, 5f, 0f))); PxRigidActorExt.createExclusiveShape(ref *box5, new PxBoxGeometry(halfExt), *gMaterial, defaultShapeFlags); PxRigidBodyExt.updateMassAndInertia(ref *box5, density); gScene->addActor(ref *box5); PxRigidDynamic *box6 = gPhysics->createRigidDynamic(new PxTransform(new PxVec3(-0.25f, 4.5f, 0f))); PxRigidActorExt.createExclusiveShape(ref *box6, new PxBoxGeometry(halfExt), *gMaterial, defaultShapeFlags); PxRigidBodyExt.updateMassAndInertia(ref *box6, density); gScene->addActor(ref *box6); PxRigidDynamic *box7 = gPhysics->createRigidDynamic(new PxTransform(new PxVec3(0.25f, 4.5f, 0f))); PxRigidActorExt.createExclusiveShape(ref *box7, new PxBoxGeometry(halfExt), *gMaterial, defaultShapeFlags); PxRigidBodyExt.updateMassAndInertia(ref *box7, density); gScene->addActor(ref *box7); }
public virtual PxQuat getTargetOrientation() { PxQuat ret = new PxQuat(physxPINVOKE.PxArticulationJoint_getTargetOrientation(swigCPtr), true); return(ret); }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PxQuat obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr); }
public PxQuat getConjugate() { PxQuat ret = new PxQuat(physxPINVOKE.PxQuat_getConjugate(swigCPtr), true); return(ret); }
public PxQuat getNormalized() { PxQuat ret = new PxQuat(physxPINVOKE.PxQuat_getNormalized(swigCPtr), true); return(ret); }