I'm going to think about scope later. But I checked it with serengeor's additional line and this still gives me the same compilation error as before as well as a new one:
Code: Select all
linking ../../bin/Linux/Collision (g++)
main.cpp: In constructor ‘deflect::deflect()’:
main.cpp:45:2: error: uninitialized reference member ‘deflect::animator’
main.cpp: In function ‘int main()’:
main.cpp:205:30: note: synthesized method ‘deflect::deflect()’ first required here
main.cpp:206:27: error: no match for ‘operator=’ in ‘bump->deflect::animator = ballanim’
Line 45 is here:
Code: Select all
class deflect : public scene::ICollisionCallback
{
public:
scene::ISceneNodeAnimatorCollisionResponse& animator; //line 45
virtual bool onCollision(const irr::scene::ISceneNodeAnimatorCollisionResponse& animator)
{
printf("bump\n");
};
};
And line 206 is here:
Code: Select all
scene::ISceneNodeAnimatorCollisionResponse* ballanim;
if (selector)
{
ballanim = smgr->createCollisionResponseAnimator(
selector, ball, core::vector3df(25,25,25),
balldirection, core::vector3df(0,0,0));
deflect *bump = new deflect;
bump->animator = ballanim; //line 206
selector->drop(); // As soon as we're done with the selector, drop it.
ball->addAnimator(ballanim);
ballanim->setCollisionCallback(bump);
}
I appreciate the help btw.
Edit: Okay, found the mistake, replaced & with * in line 45, everythings fine now. Thanks.