CharacterHitReports not being called
JoshPendergrass
13-08-2007 09:06:43
Having trouble getting CharacterHitReport to work. I'm not getting any error message, but they are never called when I put some code inside them.
I moved the CharacterHitReports mHitReports to be public.
Here's my class:
class game_collisionDetection : public NxOgre::CharacterHitReport
{
public:
game_collisionDetection() { }
bool onActorHit(NxOgre::Character *, NxOgre::Actor*, NxOgre::Shape*, NxOgre::ShapeGroup*)
{
}
bool onCharacterHit(NxOgre::Character*, NxOgre::Actor*, NxOgre::Shape*, NxOgre::ShapeGroup*)
{
}
};
Any ideas?
betajaen
13-08-2007 10:53:20
Did you create an instance of it, and register it with the character controller?
JoshPendergrass
13-08-2007 21:26:25
Actually, I didn't register with the character controller.
How is this done? I found this code:
mWorld->getCharacterController->addHitReport(new myHitReport);
Seems to be old though.
betajaen
13-08-2007 22:10:28
Yep. That's it...Store a pointer of that HitReport somewhere as NxOgre won't clean it up for you.
JoshPendergrass
13-08-2007 22:43:40
Registered it with:
m_pWorld->getCharacterController()->addHitReport(m_pHitReport);
Still not being called though...
Do I need to create my character through the Character Controller, instead of mScene?
betajaen
13-08-2007 22:58:28
Go through Scene, but either way is fine.
I do notice your using a bool as a return variable and not a response, try:
class game_collisionDetection : public NxOgre::CharacterHitReport
{
public:
game_collisionDetection() { }
NxOgre::CharacterHitReport::Response onActorHit(NxOgre::Character *, NxOgre::Actor*, NxOgre::Shape*, NxOgre::ShapeGroup*)
{
}
NxOgre::CharacterHitReport::Response onCharacterHit(NxOgre::Character*, NxOgre::Actor*, NxOgre::Shape*, NxOgre::ShapeGroup*)
{
}
};
JoshPendergrass
13-08-2007 23:56:57
Thanks for the very fast responses..
That seemed to do something, though I can't tell if it's being called now cause break points are give warning:
Break point will not currently be hit. Invalid File Line 14.
JoshPendergrass
15-08-2007 04:54:28
Still not being called.. Any ideas?
ANdys
17-08-2007 20:43:01
NxControllerAction CharacterController::onControllerHit(const NxControllersHit &) {
CharacterHitReport::Response response = CharacterHitReport::RS_None;
// Go through any existing reporters.
// Fire up the final reporter.
//if (response == CharacterHitReport::RS_None)
/// fire it up
return (NxControllerAction) response;
}
There are no response return like return (NxControllerAction) mBaseHitReport->onCharacterHit(character, actor, shape, group, hit);
Is it the problem?
betajaen
17-08-2007 20:47:52
It doesn't seem to be Character to Character collision reporting capable.
kungfoomasta
18-08-2007 02:20:16
Are you saying character to character collision reporting is not implemented, or is a limitation? (What is not capable, the code or the library?)
betajaen
18-08-2007 08:12:21
Yep. I haven't written the code in NxOgre yet.
JoshPendergrass
19-08-2007 12:36:02
Character to Actor should still work though correct?
betajaen
19-08-2007 12:43:52
Yes, else you'd fall through the floor.
lexchou
20-08-2007 13:38:43
I got the same problem, I registered the NxOgre::CharacterHitReport, but when a actor hits a character, the callback onCharacterHit doesn't execute.
I don't know why
lexchou
20-08-2007 15:41:56
In my test, I use a box mesh(created as an actor) and let it free drop to hit a robot mesh(created as a character).
I wonder, does free drop can be considered as a hit?
Edit:
I have tested, I can get onActor notification(when a character free drop to terrain), but onCharacter(when an actor free drop to a character) does not. I dont know why
betajaen
20-08-2007 16:44:22
onCharacter notification (Character to Character) does not work as the code hasn't been written.
But you have (Actor to Character, or Character to Actor) collision working?
lexchou
21-08-2007 01:06:16
onCharacter notification (Character to Character) does not work as the code hasn't been written.
But you have (Actor to Character, or Character to Actor) collision working?
Yes, I'm trying to write a TPS game demo for my graduate program. a monster should response for being shot by a bullet.
my code without physical engine implements this by using OctreeSceneManager, but you said using NxOgre should not use that
#-_- , now I don't know how to do next
betajaen
21-08-2007 09:25:50
Why not use a Raycaster for bullets? Most game engines do, else it would be insane to get PhysX to calculate very high-speed projectiles that number in the hundreds all the time.
lexchou
21-08-2007 10:30:04
Why not use a Raycaster for bullets? Most game engines do, else it would be insane to get PhysX to calculate very high-speed projectiles that number in the hundreds all the time.
Thank you for your advice, I thought using physical engine may speed up this procedure.
Can you tell me when do you release 1.0 NxOgre? it's really an excellent library, does the 1.0 release will come with tutorials, documents and samples ?
betajaen
21-08-2007 10:57:29
Well a Physics Engine is more accurate that way, and a physics ray caster is accurate to the polygon level. I believe Ogre is only down to the bounding box.
And November the 1st.
JoshPendergrass
24-08-2007 09:01:57
Still having trouble getting the CharacterHitReport to work. I used the cake sand box and copied the class over and was able to get my break points to hit.
So it has to be something in my code I've spent about 10 hours today trying to figure it out turning things on and off.
Is there anything that needs to be turned on such as framelistener? Or included or loaded?
Any help is much appreciated.
Thanks
betajaen
24-08-2007 10:15:42
Nope. Nothing, NxOgre handles everything like that for you.
If you want to send me the code, I will look at it for you. With the full most discretion and respect to your privacy. PM me if you want to.
betajaen
24-08-2007 12:54:49
I've solved your problem, for the public record, the example HitReporter is wrong.
This is a correct way on how to do a Character Hit Reporter:
class myHitReport : public CharacterHitReport {
CharacterHitReport::Response onActor(Character*, Actor*, Shape*, ActorGroup*, const NxControllerShapeHit&) {
std::cout << "Actor Hit!!" << std::endl;
return CharacterHitReport::RS_Push;
}
CharacterHitReport::Response onCharacterHit(Character*, Actor*, Shape*, ActorGroup*, const NxControllerShapeHit&) {
std::cout << "Character Hit!!" << std::endl;
return CharacterHitReport::RS_Push;
}
};
Josh. I've emailed you the fix to your code.
JoshPendergrass
24-08-2007 13:29:10
Got it, works perfect!
Thanks again
skumancer
22-10-2008 22:00:38
I need a little help.
For some reason, onCharacter is never being called. I get a call to onActor whenever we touch an actor, but onCharacter is never, ever called.
We sub-classed HitReport and implemented onCharacter and onActor.
Help would be greatly appreciated!! We are using NxOgre 0.9
- Ricardo
NoodlesOnMyBack
22-10-2008 22:33:23
:oops:
I got the same problem, I registered the NxOgre::CharacterHitReport, but when a actor hits a character, the callback onCharacterHit doesn't execute.
I don't know why 
Maybe a stab in the dark, but have you tried to set the characters and bodies on the same group? ->setGroup(1);
[EDIT]

this post was old, i just missed the date of the thread for some reason... [/EDIT]