Triggers broken

Backov

10-07-2007 18:30:53

Not sure exactly what revision I have - revision 23? Dunno - anyway, I pulled it off the SVN server on july 5th.

Triggers are currently broken. I get a failure at NxScene->createActor().. Inserting a assert(ad.isValid()) before that tells me that the actor description is indeed invalid.

I haven't attempted to discern exactly what the problem was - creating the trigger manually with the direct PhysX interface worked fine.

betajaen

10-07-2007 19:00:51

I noticed NxActors are invalid with a trigger that isn't static. Did you pass on "static: yes" to the params?

Backov

10-07-2007 19:34:30

I noticed NxActors are invalid with a trigger that isn't static. Did you pass on "static: yes" to the params?

Nope, and I didn't with the base Ageia code either:
NxActorDesc actorDesc;
NxBoxShapeDesc boxDesc;

boxDesc.dimensions = NxVec3(1.5,3,1.5);
boxDesc.shapeFlags |= NX_TRIGGER_ENABLE;

actorDesc.shapes.push_back(&boxDesc);
actorDesc.globalPose.t = NxVec3(0,1.5,-47);

NxActor *nxactor = scene->getNxScene()->createActor(actorDesc);
nxactor->userData = (void*)-1;

scene->getNxScene()->setUserTriggerReport(this);

Aiursrage2k

11-07-2007 02:31:27

Trigger shapes will not contribute to a shape’s mass when computing the mass from the shapes. For this reason, a mass and inertia must be explicitly supplied when a dynamic actor is created from trigger shapes alone.
Triggers are excluded from raycasts and sweep tests.

alejandro

11-07-2007 16:42:11

i also have problems with triggers

the virtual function doesnot return the correct shape or the pointer

note : i am moving the trigger, every frame, with my character , and expect that detect some thing that i need,
can i?


this is my code

void myTriggerCallback::onTrigger(NxShape& triggerShape, NxShape& otherShape, NxTriggerFlag status)

if( status & NX_TRIGGER_ON_STAY)
{
if (otherShape.getActor().getGroup() ==19)
{
// do something
}
}
how can i get the actor of the shape ?


and other question can i make the trigger non static, and move with my character?

betajaen

11-07-2007 16:57:53

You should use intersections instead of triggers if your going to do it that way.

alejandro

11-07-2007 21:34:09

can you gime a example , i really cant find the ageia docs

<~Creatine~>

14-07-2007 12:28:56

i also have problems with triggers

the virtual function doesnot return the correct shape or the pointer

note : i am moving the trigger, every frame, with my character , and expect that detect some thing that i need,
can i?


this is my code

void myTriggerCallback::onTrigger(NxShape& triggerShape, NxShape& otherShape, NxTriggerFlag status)

if( status & NX_TRIGGER_ON_STAY)
{
if (otherShape.getActor().getGroup() ==19)
{
// do something
}
}
how can i get the actor of the shape ?


and other question can i make the trigger non static, and move with my character?


//make
NxActor* AI_sensor = aScene->createTrigger("AIsensor", "cube", new CubeShape(200, 200, 200), NxOgre::Pose(Ogre::Vector3(0, 0, 0)));

Body* character = ...
character->setName("character1");

//render loop or other timing
AI_sensor->setGlobalPosition(character->getNxActor()->getGlobalPosition());

//reporting
class TriggerReporting : public TriggerReport
{
void onEnter(NxActor* trigger_actor, NxOgre::Body* other_body)
{
if(trigger_actor->getName() == "AIsensor" && other_body->getName() == "character1")
other_body->...
...
}
}

;)