Page 1 of 1

cant use class inheitance with the IAnimationEndCallback cla

Posted: Sat Oct 13, 2007 9:02 pm
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

Posted: Sat Oct 13, 2007 11:43 pm
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

Posted: Sat Oct 13, 2007 11:53 pm
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.

Posted: Sun Oct 14, 2007 12:22 am
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

Posted: Sun Oct 14, 2007 12:27 am
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.

Posted: Sun Oct 14, 2007 3:52 am
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();

Posted: Sun Oct 14, 2007 4:46 am
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

Posted: Sun Oct 14, 2007 10:35 am
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.

Posted: Sat Oct 20, 2007 10:57 am
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

Posted: Sat Oct 27, 2007 1:15 am
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

Posted: Wed Nov 14, 2007 5:28 am
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