*
Login | forgot password | register | register with OpenID Click here to register with OpenID
X

What is OpenID?

OpenID is an Internet-wide identity system that allows you to sign in to many websites with a single account.

With OpenID, your ID becomes a URL (e.g. http://username.myopenid.com/). You can get a free OpenID for example from myopenid.com.

For more information visit the official OpenID site.

(what is OpenID?)

Forums

45 Posts in 15 Topics by 16 members

Jump to:

General Discussion

If this is your first visit, you will need to register before you can post. However, you can browse all messages below.

Imaginary Game Engine » Forums » General Discussion » Scene::createJoint() problem
Page: 1 go to end Reply
Author Topic: Scene::createJoint() problem 632 views
  • MoP
    MoP's avatar
    Community Member
    5 posts

    Scene::createJoint() problem

    Hi.
    scene.createJoint() returns null value. I've tried different joint types, all is the same.

    The following is my function for creating distance joint:

     
    Public Function CreateDistanceJoint(ByVal scene As NxScene, ByVal a0 As NxActor, ByVal a1 As NxActor, ByVal anchor0 As Vector3, ByVal anchor1 As Vector3, ByVal globalAxis As Vector3) As NxDistanceJoint
    Dim distanceDesc As New NxDistanceJointDesc
    distanceDesc.actor(0) = a0
    distanceDesc.actor(1) = a1
    distanceDesc.localAnchor(0) = DXVec2Nx(anchor0)
    distanceDesc.localAnchor(1) = DXVec2Nx(anchor1)
    distanceDesc.setGlobalAxis(DXVec2Nx(globalAxis))
     
    Dim dist As Vector3
    dist = Vector3.Subtract(NxVec2DX(a0.getGlobalPosition), NxVec2DX(a1.getGlobalPosition))
    distanceDesc.maxDistance = dist.Length() * 1.5
    distanceDesc.minDistance = dist.Length() * 1
     
    Dim spring As New NxSpringDesc
    spring.spring = 100
    spring.damper = 0.5
     
    distanceDesc.spring = spring
    distanceDesc.flags = NxDistanceJointFlag.NX_DJF_MIN_DISTANCE_ENABLED Or NxDistanceJointFlag.NX_DJF_MAX_DISTANCE_ENABLED
    distanceDesc.flags = distanceDesc.flags Or NxDistanceJointFlag.NX_DJF_SPRING_ENABLED
    distanceDesc.jointFlags = distanceDesc.jointFlags Or NxJointFlag.NX_JF_COLLISION_ENABLED
    Return scene.createJoint(distanceDesc)
    End Function
     

    What am I doing wrong?

    *SE1: Added code tags*

    Last edited: 20 December 2008 at 7:35pm

  • SeaEagle1
    SeaEagle1's avatar
    Administrator
    16 posts

    Re: Scene::createJoint() problem

    I'll run some tests myself on this, but it might be because of wrong axis or anchor settings. Do you get any errors from PhysX (using its PhysicsSDK.setErrorStream)?

  • MoP
    MoP's avatar
    Community Member
    5 posts

    Re: Scene::createJoint() problem

    After calling scene.createJoint(distanceDesc), I get an error NXE_INVALID_PARAMETER.

    distanceDesc.isValid() always returns True, but in wrapper version 0.9.1 it was always False (now I use 0.9.2).

    Could you give me please working code example for creating joints?

    Last edited: 20 December 2008 at 8:52pm

  • SeaEagle1
    SeaEagle1's avatar
    Administrator
    16 posts

    Re: Scene::createJoint() problem

    Here is the demo code I'm using: http://svn.imaginary-project.net/index.cgi/IGE/view/ige/trunk/IGE%20Demo/Demo.cs look around line 390 for PhysX joints. Just noticed that you're setting NxJointDesc.actor[0] and [1] seperately (and localAnchor too). This probably won't be passed on to PhysX correctly.

    (see the PhysX-sharp page: Properties have to be explicitly set. This means that if, for example, a property returns a vector, just changing the vector won't do anything, you'll have assign the new vector explicitly to the property (much like value type properties in C#))

  • MoP
    MoP's avatar
    Community Member
    5 posts

    Re: Scene::createJoint() problem

    Thanks. Now it works

    632 views
go to top Reply

Currently Online:

There is nobody online.

Welcome to our latest member: jfreie