Using PysX 2.7

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Using PysX 2.7

      I'm using 2.7, since its impossible to get 2.3... they say in the forums that they are backwards compatible so either they really arent or these errors are due to not having it setup up all correctly, eitherway, heres the errors im getting... (release build)


      'NX_MIN_SEPARATION_FOR_PENALTY' : undeclared identifier
      'broadPhase' : is not a member of 'NxSceneDesc'
      'NX_BROADPHASE_COHERENT' : undeclared identifier
      'collisionDetection' : is not a member of 'NxSceneDesc'
      'NX_VISUALIZE_BODY_CONTACT_LIST' : undeclared identifier
      'NX_VISUALIZE_BODY_LIN_FORCE' : undeclared identifier
      'NX_VISUALIZE_BODY_ANG_FORCE' : undeclared identifier
    • RE: Using PysX 2.7

      I love how fast they change their API - NOT.

      Anyway - I'd look up the PhysX help for the function calls that are giving you trouble and find the new constant values they need - you may need to search for the constants themselves in the helop - perhaps they are still used but in the different function.
      Mr.Mike
      Author, Programmer, Brewer, Patriot
    • RE: Using PysX 2.7

      I had the same problem with this. You should really have a look at the "Whats new" docs, as sometimes they can be really quite helpful. The 'NX_MIN_SEPARATION_FOR_PENALTY' has been replaced with 'NX_SKIN_WIDTH', where (according to the docs) NX_SKIN_WIDTH =NX_MIN_SEPARATION_FOR_PENALTY * 0.5 from what I can remember.

      And I think 'NX_VISUALIZE_BODY_CONTACT_LIST' has been replaced with 'NX_VISUALIZE_BODY_CONTACT_POINTS' or something of the sort. My suggestion is to actually backtrack through the SDK changes from version 2.3 onwards.
      If you put your mind to it, you can accomplish anything.
    • Well I got it to compile with physx for the first time... but it is waaay messed up. The max speed of the teapot must be wrong because i am accelerating to massive speeds when i just tap the keyboard, then if i plow into the ramp i go flying across the map and bouce off the world limits, then i was stuck sideways for a while ... lol

      Did this happen for anyone else? I guess I'll basically have to learn to use PhsyX just to get it somewhat normal looking.

      Or can I just remove PhysX from it entirely? Isnt it seriously overkill? How would I go about removing it, and then how would I handle collisions?
    • Disregard my last post...

      I'm not sure if commenting out one of those lines that was giving an error in Physics.cpp is whats causing this, but I have at least an idea of how to fix it.

      I noticed you (Mr.Mike) are "turning" the teapots by applying a torque-force, and doing movement by applying a force, this could work but I think the teapots need to do setLinearVelocityMax and setAngularVelocityMax, but I cant figure out where exactly to do this.

      Also, the way I would intuitively do this would be to use setLinearVelocity and setAngularVelocity and not mess around with "forces", is this possible or what is the reason for your choice?
    • What units are used when applying a force to an actor to turn or move it?

      I found this defined in the teapotwars.cpp event handler:

      static const float newtonForce = 500000 * 1.8f;

      My quess is that this is just to much force, but I dont know how to find a good value except for randomly quessing.

      What im actually doing is calling
      setAngularVelocity(force)
      where force = newtonForce * direction

      What kindof formulas are there, like... if mass of actor is X, then an angular velocity of Y will revolve it completely in Z seconds... or something
    • I found out the problem with using setlinearvelocity, it overrides the force of gravity, although the teapot still falls, it is very very slowly. So, i changed VsetLinearVelocity to preserve the Y axis velocity and only set the X and Z. However, the falling speed is still very slow. I found where to modify the defaultGravity and that helped

      I also added a test in teapotcontroller::onUpdate to set the linear or angular velocities to zero neither a/d or w/s were pressed. Basically I'm changing the controls to a FPS style from the vehicle style.

      The post was edited 2 times, last by JamesFord ().

    • The constants in the force were "tweaked" until it "felt" right...so maybe there has been some change to invalidate those constant values....
      Mr.Mike
      Author, Programmer, Brewer, Patriot
    • Where is the mass of a teapot set? I imagine this has a lot to do with how much force is required to move it, so I might want to modify that as well if i can find it.

      Also, has anyone tried setting the momentum rather than the velocity? The PhysX documentation seems to say this will set the velocity independent of the actors mass, but I'm not so sure.

      The post was edited 1 time, last by JamesFord ().

    • updated for latest code and physx sdk...

      1)
      replace current BaseGamePhysics::VInitialize with the code below.. or the portion of it

      //
      // BaseGamePhysics::VInitialize - Chapter 15, page 561
      // renamed from BaseGamePhysics::Initialze in the book.
      //
      bool BaseGamePhysics::VInitialize()
      {
      m_bPause = false;
      m_pPhysicsSDK = NULL;
      m_pScene = NULL;
      m_DefaultGravity = NxVec3(0.0f, -9.81f, 0.0f);

      // Initialize PhysicsSDK
      NxPhysicsSDKDesc physicsSDKDesc;
      NxSDKCreateError errorCode = NXCE_NO_ERROR;
      m_pPhysicsSDK = NxCreatePhysicsSDK(NX_PHYSICS_SDK_VERSION, &m_PhysicsAllocator, &m_PhysicsErrorStream, physicsSDKDesc, &errorCode);
      assert(m_pPhysicsSDK && "We expect m_pPhysicsSDK to not be NULL at this point");
      if(!m_pPhysicsSDK)
      return false;

      // Create a scene
      NxSceneDesc sceneDesc;
      sceneDesc.gravity = m_DefaultGravity;
      sceneDesc.userContactReport = &m_ContactReport;

      m_pScene = m_pPhysicsSDK->createScene(sceneDesc);
      if (!m_pScene)
      return false;

      2)

      at the bottom of that function, comment out all the debug stuff....

      // These calls set the parameters of the physics debugger
      /*m_pPhysicsSDK->setParameter(NX_VISUALIZATION_SCALE, 1.0f);
      m_pPhysicsSDK->setParameter(NX_VISUALIZE_COLLISION_SHAPES, 1);
      m_pPhysicsSDK->setParameter(NX_VISUALIZE_BODY_CONTACT_LIST, 0);
      m_pPhysicsSDK->setParameter(NX_VISUALIZE_CONTACT_POINT, 1);
      m_pPhysicsSDK->setParameter(NX_VISUALIZE_CONTACT_NORMAL, 1);
      m_pPhysicsSDK->setParameter(NX_VISUALIZE_CONTACT_FORCE, 0);
      m_pPhysicsSDK->setParameter(NX_VISUALIZE_JOINT_WORLD_AXES, 0);
      m_pPhysicsSDK->setParameter(NX_VISUALIZE_JOINT_LIMITS, 0);
      m_pPhysicsSDK->setParameter(NX_VISUALIZE_BODY_LIN_FORCE, 1);
      m_pPhysicsSDK->setParameter(NX_VISUALIZE_BODY_ANG_FORCE, 1);*/

      3) install both PhysX_7.03.21_SystemSoftware.exe and PhysX_2.7.0_SDK_Core.exe. If you just install the sdk ( like you assume the binaries are installed if you just install the sdk ) then youll go nuts tring to figure out why physx crashes on startup.

      Im pretty sure thats all there is to it.

      The games pretty clunky ( as expected since the physics values arent tweaked for the latest version), but honestly, you gotta read the book and figure out all the mechanics for yourself anyway, so ...

      later,
      -stellar

      The post was edited 5 times, last by Stellar ().