TRY EVERYTHING
One of the most important lessons I have learned as a programmer is the value of trying different things and attempting new approaches. if you are faced with a particular coding problem and you can't even begin to think of how to solve it you need to close the laptop, sit down and think about it. another important lesson I learned - more than 50% of programming is thinking about programming. But sometimes it is difficult even attempting that.now any student of comp sci will be familiar with the practice of breaking your problem down into sub problems and then tackling each problem individually. This is the basis of the bottom up approach, and yes it is a bit tired and overused and you probably heard your intro prof mention it 500 times, and quite frankly it should be intuitive. but it wasn't until later on in my studies that I actually realized how very important this process was to creating good conventional code.Creating a Program using the TwoLoc engine(wrapping Ogre, Havok and FBX loading) has been a wild ride for me. I had no idea how to read in cameras, and a slice of code that said "mayaCamera" tempted/fooled me for way too long. it turns out that you can't actually read in the maya camera, well you can but not in any sort of time frame that is worth your sanity. My goal was simple. get a camera to rotate around an object, you know like Naruto ultimate ninja storm style. this is a cool way to get nice action shots. but where to start?(isn't that so cool? I learned about this camera rotation technique and how powerful it is to make in game animations more effective from the actual CEO of Cyber Connect himself during a game developers conference in montreal. so you could imagine my excitement when I saw it was a HOMEWORK question... Spoiler alert *my scene doesn't quite look as cool)well Ogre is very powerful when it comes to rendering many different objects, but I didn't realize that TwoLoc only has built in functions to load NODES... nodes and nodes only. this was mistake 1. trying to load in a curve animation with the camera from a Maya FBX was agonizing. I don't know why I thought it would be that simple... sometimes programming is magic... nono. you need to animate that shit yourself son.so get rid of that curve. and just use the ogre camera, I was able to attach it to a node read in from the fbx, but the tricky part was still animating (remember don't stop trying until you are literally OUT of ideas) but what I replaced it with was something even stupider.so I thought maybe instead of trying to read in curve points I could just put in a bunch of maya cameras, read their nodes. (essentially a bunch of x y z values) and then lerp between them... no... wrong again. try something else...which I did. I found out theres an actual object in maya called a locator (how did I not know this?) this is much cleaner than using cameras which may have been accessing the mysterious "maya camera" that is apparently available. again I did NOT want to touch that one with a 10 foot pole. ogre camera attached to an animating maya node was good enough for me.so where does that leave me?I had 4 locators, a camera node and an ogre camera that I attached to it. now to animate it and good to go!! ya??? ... no.http://www.youtube.com/watch?v=rC7vH9UNsAQ(could not have summed this up all of programming better myselft. thank you Lucy Lu and Uma Thurman)let me tell you about listeners.I was trying to use Ogres built in LERP function to get the camera to move, but the thing wouldn't budge. I COULD however see 4 static viewpoints of my object. just by setting my camera node to one of the locators( I must be getting closer!! what the heck else do I need?)listeners are used by havok and ogre to control animations. I wasn't sure weather it would be necessary for a keyframe animation but I spent hours upon hours researching them anyways JUST to find out.the sad truth is I just yanked the good ol catmull rom spline code from my animations course a few years back.this code worked better than anything havok or ogre provided me. not that my code is better or anything. I just understood it, and it was very obvious to me how it worked.programming is a very dark sadistic place. sometimes you think you are learning something new and you get so excited to implement your new knowledge but it just hurts you to try. that is why I am thankful for university. it allows you to make these mistakes and learn from them. and when you actually do make some sort of progress from what you learned, it is an overwhelming rush of happiness and joy. (no actually I don't think I have ever felt something quite rewarding as mastering a new function or systematic approach to something and then seeing your own program actually compile because of it)