cant use class inheitance with the IAnimationEndCallback cla

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
wREAKAILDRON
Posts: 38
Joined: Tue Aug 21, 2007 6:54 pm
Contact:

cant use class inheitance with the IAnimationEndCallback cla

Post by wREAKAILDRON »

every time I try to use the class IAnimationEndCallback class like this:


class Character : public IAnimationEndCallback
{
};

it never works. Is there a missing headfile or something im missing to be able to use this class in one of my classes?

or is there a way to find out what frame of animation my IAnimatedSceneNode is on?
________
Mercedes-benz sprinter history
Last edited by wREAKAILDRON on Tue Feb 22, 2011 6:55 am, edited 1 time in total.
wREAKAILDRON
Posts: 38
Joined: Tue Aug 21, 2007 6:54 pm
Contact:

Post by wREAKAILDRON »

to compute the amount of time the attack animation can accumulate, i want to know if i came up with the right formula. Im doing (accumulator) +=(constant number, divided by the frame rate) to add up time.

is that right? i came up with it in about 10 seconds, and im not concerned with being accurate with world time (hours and seconds). i just wanted some number to accumulate by, no matter what the frame reate is. If the only thing i did wrong is not sink up my measurement to clock time expanses, I dont watn to hear your answer. I just want some differing framerate worthy accumulation number of the amount of time my attack animatin takes.

so i did (attacktimeaccumulator) += (constant number, divided by the frame rate)

im guessing if my formula works, i could also come up with a clock that goes by this time measurement, that doesnt go by hours and seconds and miutes, no matter what the irrlicht frame rate is, and i might make a clock in the game becuase of my neat formula.

is it right? it seems simple.

and i could go on to guess that how clockmakers made clocks, from the amount of rotations a clock gear would rotate a minute, being powerd by a measured battery, to keep the first acurate and constant time measurement; how many times a gear could rotate a minute on a battery power, and thus defining a constant curent of electricity? rotating a gear per minute, defining a constant power given by an electricity source
________
Think Mill
Last edited by wREAKAILDRON on Tue Feb 22, 2011 6:55 am, edited 4 times in total.
Ico
Posts: 289
Joined: Tue Aug 22, 2006 11:35 pm

Post by Ico »

Never used that animation callback thingy but to use the callback classes I know you have to create/overload some special function within your custom class that's then called as a callback (pseudo code):

Code: Select all

class mycallbackclass : public icallbackclassbase
{
public:
  mycallbackclass()
  {
    constructorthingies();
  };

  void callbackfunction(someparams, moreparams)
  {
    my_code_to_be_run_when_animation_is_done();
    evenmorecode();
  }
};

----------

mycallbackclass* cb=new mycallbackclass();
function_wanting_callback_parameter(..., cb);
wait_for_callback_and_animation_done();
delete mycallbackclass();
If you get compiler errors complaining about abstract methods etc. you have to implement those methods for your derived class too.
wREAKAILDRON
Posts: 38
Joined: Tue Aug 21, 2007 6:54 pm
Contact:

Post by wREAKAILDRON »

am i right though?

(mommy where did electiricy come from?)
i mean is my formula right? at least the function is working.

im sorry, is it?
________
DRAGONBALL Z FORUMS
Last edited by wREAKAILDRON on Tue Feb 22, 2011 6:55 am, edited 1 time in total.
Ico
Posts: 289
Joined: Tue Aug 22, 2006 11:35 pm

Post by Ico »

I'd guess it won't work if your frame rate isn't constant. And that's something you can't have all the time. You can limit your frame rat to (i.e.) 60 fps but you'll still run into problems if you can't manage to render that many frames (getting stuck at 30 - 40 or so). Better try to get the callback working.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

Code: Select all

class MyAnimationEndCallBack : public scene::IAnimationEndCallBack
{
public:
    virtual void OnAnimationEnd(scene::IAnimatedMeshSceneNode* node)
    {
       // do something
    }
};

// in main
scene::IAnimatedMeshSceneNode* msn =
    smgr->addAnimatedMeshSceneNode(smgr->getMesh("../../media/dwarf.x"));

// add the animator
scene::IAnimationEndCallBack* cb = new MyAnimationEndCallBack;
  msn->setAnimationEndCallBack(cb);
cb->drop();
wREAKAILDRON
Posts: 38
Joined: Tue Aug 21, 2007 6:54 pm
Contact:

Post by wREAKAILDRON »

constant 1

c1 / 6fps = .16..................

c1 / 6fps * 6fps * 60secondsperminute = 60

c1 / 31fps = .032...............

c1 / 31fps * 31fps * 60secondperminute = 60



c1 / 6fps * 6fps * 30seconds = 30
c1 / 31fps * 31fps * 30seconds = 30
30 + 30 = 60?
________
Honda vtr1000
Last edited by wREAKAILDRON on Tue Feb 22, 2011 6:55 am, edited 1 time in total.
Ico
Posts: 289
Joined: Tue Aug 22, 2006 11:35 pm

Post by Ico »

On paper it will work - but just use vitek's code for the callback.

Fps are calculated "per second" but you have to render x frames per second (and therefor alter the counter x times per second too). It will work but it won't be as accurate as the end callback will be.
wREAKAILDRON
Posts: 38
Joined: Tue Aug 21, 2007 6:54 pm
Contact:

Post by wREAKAILDRON »

thats great! :P

i needed something else now, having to do with something that i forgot, and i now i think i can do "it" because of this formula being moderatly accurate.
________
FIND HEADSHOP
Last edited by wREAKAILDRON on Tue Feb 22, 2011 6:56 am, edited 1 time in total.
wREAKAILDRON
Posts: 38
Joined: Tue Aug 21, 2007 6:54 pm
Contact:

Post by wREAKAILDRON »

yeah i dont think my problem here got fixed because the driver->getFPS() function doesnt update by the millisecond, but it may be good enough for combo moves, possibly
________
GIRLFRIEND PIC
Last edited by wREAKAILDRON on Tue Feb 22, 2011 6:56 am, edited 1 time in total.
kornwaretm
Competition winner
Posts: 189
Joined: Tue Oct 16, 2007 3:53 am
Location: Indonesia
Contact:

Post by kornwaretm »

Hi there...
this is a sample of ordinary Object Oriented :

Code: Select all

class human{
......
.....
};
main(){
.....
human.walking();
.....
}
why all classes in irrlicht engine using pointer to call their methods? the answer is because they are abstract classes. what is abstract classes? a class with a pure virtual functions. an abstract class can't be use to inheritance, and equalize
:oops:
(i'm indonesian). you can only use a pointer to point on it. why they use abstract classes? because they have to make sure that they share the same instantiated objects.

may be if u want to inherit them you should treat them as abstract class to. i think it will be better if you make a ondinary class with "that class" inside it. try to search with google, use the error code as the key word.

hope this helps
Post Reply