Earthquakes! :o

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
disanti
Posts: 367
Joined: Sat Jan 17, 2004 1:36 am
Location: California, US
Contact:

Earthquakes! :o

Post by disanti »

Hello all,
I'm trying to make my camera shake when the player is in the game's elevator... I've tried the Follow Spline animator, and it worked, BUT it never stopped. It wouldn't even stop when I removed the animator!

So any suggestions or ideas would be greatly appreciated...
Thanks very much~ John DiSanti
________
Motorcycle tires
Last edited by disanti on Thu Feb 24, 2011 10:34 am, edited 1 time in total.
puh
Posts: 356
Joined: Tue Aug 26, 2003 3:53 pm

Post by puh »

Hm, are you sure it never stops? Anyway you could try to use another camera while player uses elevator. And then switch back to the main cam.
disanti
Posts: 367
Joined: Sat Jan 17, 2004 1:36 am
Location: California, US
Contact:

Post by disanti »

Nice idea, I'll give that a go!
Thansk~ John DiSanti
________
MERCEDES-BENZ S-CLASS HYBRID SPECIFICATIONS
Last edited by disanti on Thu Feb 24, 2011 10:34 am, edited 1 time in total.
disanti
Posts: 367
Joined: Sat Jan 17, 2004 1:36 am
Location: California, US
Contact:

Post by disanti »

Ok, it works... thanks very much for the idea! :)
________
Extreme Vaporizer
Last edited by disanti on Thu Feb 24, 2011 10:34 am, edited 1 time in total.
puh
Posts: 356
Joined: Tue Aug 26, 2003 3:53 pm

Post by puh »

No problem, John. BTW - what is your project? Will it be released soon? Maybe some screenshots?..
melon2005

shake animator

Post by melon2005 »

I've wrote shake animator some time ago. Don't really know if it will help, but.. here's the code:

Code: Select all

class IShakeItAnimator : public ISceneNodeAnimator
{
    public:
        IShakeItAnimator(u32 ShakeTime, u16 Amp);
        virtual ~IShakeItAnimator() {};
        virtual void animateNode(ISceneNode *node, u32 timeMs);
    private:
        vector3df startPosition;
        u32 mStartTime;
        u32 mTimeToShake;
        u16 Amplitude;
        s8 Direction;
};

IShakeItAnimator::IShakeItAnimator(u32 ShakeTime, u16 Amp)
{
    mStartTime = 0;
    mTimeToShake = ShakeTime;
    Amplitude = Amp;
    Direction = 1;
}

void IShakeItAnimator::animateNode(ISceneNode *node, u32 timeMs)
{
    if (!mStartTime)
    {
        mStartTime = timeMs;
        startPosition = node->getPosition();
    }
    u32 passedTime = timeMs - mStartTime;
    if (passedTime > mTimeToShake)
    {
        node->setPosition(startPosition);
        return;
    }

    float progress = float(passedTime) / float(mTimeToShake);
    node->setPosition(vector3df(node->getPosition().X + ((1-progress)*Amplitude)*Direction, node->getPosition().Y, node->getPosition().X));
    Direction *= -1;
}
Of course it's very basic (and it shakes in X direction only:). It behaves like "single dinosaur's step;)" - first maximum impact, then amplitude goes to zero in given time.
disanti
Posts: 367
Joined: Sat Jan 17, 2004 1:36 am
Location: California, US
Contact:

Post by disanti »

Awesome work melon2005! I'll put that to good use! :)
Was it just me or were the Irrlicht forums really unbarably slow for a few days?

Puh, I've been working pretty hard on it... you can take a look on my new website:
http://sknetwork.no-ip.org/
Project title: Project Space Squad 4086
I just finished the first level too.

~John DiSanti
________
Motorcycle Tires
Last edited by disanti on Thu Feb 24, 2011 10:35 am, edited 1 time in total.
melon2005

Post by melon2005 »

your web address is not working :(

for shake animator: I use it for "world" node - and I'm not sure if it will work for anything else. But I'm sure it's easy to adapt.
disanti
Posts: 367
Joined: Sat Jan 17, 2004 1:36 am
Location: California, US
Contact:

Post by disanti »

Ooopps!! :oops:
The real link that works: http://amnesiasoft.no-ip.org/
Sorry!
________
Algerian recipes
Last edited by disanti on Thu Feb 24, 2011 10:36 am, edited 1 time in total.
tip
Posts: 50
Joined: Fri Feb 13, 2004 8:53 am
Location: grenoble, France
Contact:

code correction

Post by tip »

bug in setPosition : use Z for Z, not X ?
Post Reply