*
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 » how to setUserContactReport() ?
Page: 1 go to end Reply
Author Topic: how to setUserContactReport() ? 93 views
  • croc
    croc's avatar
    Community Member
    1 posts

    how to setUserContactReport() ?

    Basing on a sample provided in the PhysX SDK I've been trying to make the physics system notify me when a collision of two specified objects takes place. Simple scene test looks like this (last lines are essential):

     
    public override void CreateScene()
    {
    physicsSpace = new PhysicsSpace();
     
    Matrix transform = Matrix.Identity;
    Matrix box_transform = Matrix.RotationX(3.1415f / 4) * Matrix.Translation(0, 9.81f, 0);
     
    NxPlaneShapeDesc planedesc = new NxPlaneShapeDesc();
    planedesc.normal = Utils.vec3(0, 1, 0);
    planedesc.d = 0;
     
    plane = physicsSpace.CreateStatic(planedesc, ref transform);
     
    NxBoxShapeDesc boxdesc = new NxBoxShapeDesc();
    boxdesc.dimensions = Utils.vec3(2,2,2);
     
    box = physicsSpace.CreateDynamic(boxdesc, ref box_transform, 10);
     
     
     
    physicsSpace.Scene.setUserContactReport(new ContactReport());
    physicsSpace.Scene.setActorPairFlags(plane, box, (uint)NxContactPairFlag.NX_NOTIFY_ON_TOUCH);
     
    }
     

    Last two function calls are taken directly from the sdk sample. ContactReport is a class overriding onContactNotify function. But before it's called, following error occurs when the collision takes places:


    System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.\r\n at PhysX_sharp.NxScene.NxScene_fetchResults_1_INVOKE(HandleRef classPointer, Boolean call_explicit, NxSimulationStatus status, Boolean block)\r\n at PhysX_sharp.NxScene.fetchResults(NxSimulationStatus status, Boolean block)\r\n ........

    If there's no userContactReport or NX_NOTIFY is set to ignore nothing wrong happens. It seems that there's a problem with passing a managed c# instance to unmanaged code. My question is how should I use this feature? Is there an alternative?

    93 views
go to top Reply

Currently Online:

There is nobody online.

Welcome to our latest member: jfreie