is there a simple way to control the collision behavior??

lullideath

07-09-2006 03:43:22

I am having an AI enemy class...i have to know if the enemy hit the wall or not, if the enemy hit the wall, it would call a 'fall' animation...how am I supposed to detect the collision in nxOgre??? do I have to write the contact reporter class??

betajaen

07-09-2006 10:37:41

What is the class, is it a body or a character?

lullideath

07-09-2006 14:38:59

all bodies! :wink:

betajaen

07-09-2006 14:49:09

contactReporter or a stateContactReporter then.

I'm actually curious though how you pulled off character movement with bodies, I assume you have them fixed to the Y axis, and have lots of linear and angular dampening?

lullideath

07-09-2006 15:04:25

en....I set the LinearDampling to 1.0...I just use the simple addForce to move it around (like making it walk back and forth). The reason I use body is it's clean and simple, plus I need no more complex movement, all done by the animators...

well, if i use contactReporter, do i have to make my AI class inherit from the customContactReporter class??? and where and when should I register the contact pair??? what is the meaning of startTouch, endTouch and onTouch :?: :?: :?:

thanks a lot betajaen!!!
lullideath

betajaen

07-09-2006 15:54:45

Ahh, clever. But you may run into some trouble when you encounter stairs and things, that is what the character controller is designed for.

As for contacts it's all explained in NxTutorial303 :D

lullideath

07-09-2006 17:36:45

thanks, betajaen, the NxTutorial303 indeed explains everything!!! :mrgreen:

lullideath

09-09-2006 19:25:47

what should I do if I want the contact report happen between a body and a character??? should I change the customContactReporter class or cast the character to body :?:
thanks,
lullideath

betajaen

09-09-2006 19:35:18

Casting character to a body wouldn't work, they are completely unrelated.

There is an implementation in place, but it just moves the bodies when they touch, I do want to make a characterBodyReporter class in the future to handle custom collisions (such as bodies which are health pickups or lethal to touch) but for now there isn't anything out of the box I'm afraid.

My advice for now is to write your own characterBodyReporter class and implement it on the onShapeHit in character, it's not to hard if you copy the contactReporter class and use it as a basis.

Of the top of my head it would look a bit like this:


NxControllerAction character::onShapeHit(const NxControllerShapeHit& hit) {
...
if (actor.isDynamic()) {
...
mBodyCharacterReporter->hit(this, static_cast<body*>(actor.userData)
}

return NX_ACTION_NONE;
}

..

class CharacterBodyReporter {
public hit (character *c, body *b) {
...
}

static CharacterbodyReporter mBodyCharacterReporter;
}


Who knows you might get there before I do ;)

BlasterN

10-09-2006 11:58:46

I'm now developing this. a class to manage Players/NPCs

I have in mind this features:
- Collisions for movement: capsule/cilinder
- Collision in battle: hit boxes (need to be skeletal animated or sync bones with the boxshapes at least)
- Weapon collision: using a box too, I dont decide how to do weapons like bows.
- Animation/Movement depends of direction/weapon select a group of animations.

It will be done in a week ( I expect no problems )

M@gg!

10-09-2006 13:44:55

( I expect no problems )

[wise man on]
Always expect the unexpected, especially when you are useing beta software.
[/wise man off ;-)]

betajaen

10-09-2006 14:12:46

.....and software written by betajaen.

lullideath

11-09-2006 03:03:00

i got a simple idea, but i don't know if that would be correct (I lack the general big picture of the novodex and nxOgre!! :oops: )

well, what about i just change something in onContactNotify() function of the nxOgre_contactReporter.cpp???
Here is an example for getting my body interact with a character when they collide:

change
body *b = static_cast<nxOgre::body*>(pair.actors[1]->userData);
to
character *b = static_cast<nxOgre::character*>(pair.actor[1]->userData);

betajaen

11-09-2006 09:56:22

Hmm, I didn't think of doing it that way.

The actor in that character may report collisions but then you need to check if that actor is a body or a character, and I'm not sure if userData is used with the actor for character, if it isn't just add mCharacter.actor.userData = this in the constructor for Character.

Worth a shot.