Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

3D animation, ray picking, and junction handling

Sign in to follow this  


So, after a week of development here are the videos of the progress so far in the 3D version of Firework Factory!

A youtube version of this video can be found here.

As you can see there is now an animation system to allow for simple animation of blocks on the playing field. The example here is the simple junction box, which can be used to change the direction of travel for each of the firework crates.

As far as graphics goes, i just have to implement machines, crates, and the particle system and all basics will then be implemented.

The Animation system works by attaching an 'animation' derived class to the Box object, and then calling the DoUpdate() method of each animation object once per frame. Constructors of the Animation derived classes contain the basic instructions required to perform the animation, as shown below:[code=nocode:0]JunctionAnimation::JunctionAnimation(Box* b) : Animation(b){ instructions += AniInstruction(0.0f, 0.01f, 0.0f, 0.f, 0.0f, 0.0f, 10), // Raise up AniInstruction(0.0f, 0.0f, 0.0f, 0.f, 2.0f, 0.0f, 45), // Rotate 90 degrees AniInstruction(0.0f, -0.01f, 0.0f, 0.f, 0.0f, 0.0f, 10); // Sink down}JunctionBox::JunctionBox(float _x, float _y, float _z, float _rotation, DX11* dx11) : Box(_x, _y, _z, _rotation, dx11->textures[L"step1.png"], dx11), anim(NULL){}void JunctionBox::OnUpdate(){ if (anim) { anim->Update(); if (anim->IsFinished()) { delete anim; anim = NULL; } }}void JunctionBox::OnClick(const POINT &p, float pickedDist, const XMVECTOR &prwsPos, const XMVECTOR &prwsDir){ if (anim == NULL) { anim = new JunctionAnimation(this); }}JunctionBox::~JunctionBox(){ if (anim) { delete anim; anim = NULL; }}This uses boost::assign to make things nice and simple and easy to read smile.png

Next on the todo list: Particle effects for the crate explosions! I probably can't re-use much of the 2D particle system i created before, so wish me luck!

Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!