Page 1 of 1
Gun Recoil Animation
Posted: Fri Apr 09, 2004 3:33 am
by disanti
Code: Select all
if(recoil)
{
droid.guns[droid.gunID]->setCurrentFrame(1);
//play gun's recoil animation
if(droid.guns[droid.gunID]->getFrameNr() >= 19)
{
recoil = false;
}
}
else
{
droid.guns[droid.gunID]->setCurrentFrame(19);
}
Why, NO MATTER WHAT, does the animation ALWAYS loop?
![Confused :?](./images/smilies/icon_confused.gif)
I'm loading a gun from a X file and it plays its animation endlessly. Even if I set the current frame of the animation. How do I make it stop?
________
Michigan medical marijuana dispensaries
Posted: Fri Apr 09, 2004 3:42 am
by isiahil
After setting recoil=false set the fram to 19.
Posted: Fri Apr 09, 2004 4:43 am
by disanti
The animation is still looping. That made absolutely no difference.
________
Yamaha Music Foundation History
Posted: Sat Apr 10, 2004 3:26 pm
by pex
i dont understand in frames much, like setFrameNr..
but have you tried setFrameLoop=false;?
and i think that when the frame is >=19, recoil becomes false but the loop is still true. so maybe thats the problem.
Posted: Sat Apr 10, 2004 6:48 pm
by disanti
Niko, how do I do this? Pex... your solution gives an error. You cannot tell a function that it is false!
There must be a way to stop the darn animation!!!
![Evil or Very Mad :evil:](./images/smilies/icon_evil.gif)
________
Digital vaporizer
Posted: Sat Apr 10, 2004 7:17 pm
by Mercior
You're only setting the frame number, it is going to carry on playing the same sequence (and looping it) until you use setFrameLoop()
Posted: Sat Apr 10, 2004 8:36 pm
by disanti
Ok, I couldn't get that to work so now I'm using a new method. I'm trying to change the animation of the x file altogether (now it has 2 animations).
How do I do this?
Code:
//load the normal animation
gunanim[0] = gProc.smgr->getMesh(".\\data\\gun1\\gun1.x");
if(gunanim[0])
{
guns[0] = gProc.smgr->addAnimatedMeshSceneNode(gunanim[0],cam,-1);
guns[0]->setVisible(false);
}
Error:
d:\pss4086new\source\player.cpp(6) : error C2440: '=' : cannot convert from 'class irr::scene::IAnimatedMesh *' to 'class irr::scene::IAnimatedMeshX *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Have I done something wrong?
________
JUGGALO
Posted: Sun Apr 11, 2004 12:02 am
by Coolkat
it seems you are sending a certain class type to the function in a param that wants a different class. you cold either change the class type or typecast your code.. example..
(im assuming that gunanim[0] is the pointer to the class)
Code: Select all
guns[0] = gProc.smgr->addAnimatedMeshSceneNode((irr::scene::IAnimatedMeshX *)gunanim[0],cam,-1);
guns[0]->setVisible(false);
that should work.. or when you made the variable make it
Code: Select all
irr::scene::IAnimatedMeshX *gunanim[];
i believe you need to use the X at the end because it is a different class to handle .x files. please correct me if im wrong.