Friday, October 18, 2013

Parallax effects for game objects

This week I worked more on physics and throwing objects.  While they're great for the player, the problem I've run into with fake physics is that the systems rarely play nice together - because the systems aren't following real rules, the rules they do have often contradict each other.

I wanted to fix some of this, so I redid the systems to be more internally consistent.  The rope winch has its own acceleration system, momentum system, velocity, and most importantly, wind resistance.

Wind resistance is important because it's normally left out of physics simulations with Box2D, but it adds a level of intuitiveness to ours.  If you throw a ball out of a moving car, theoretically you could get it to bounce along side, but you never expect it to - you want it to trail off behind you.   By including wind resistance as a variable (based off of what the velocity of the helicopter is), we can get semi-realistic trailing of the rope without directly effecting the rope's underlying velocity.

I've also been playing around with parallax effects and how that effects objects l.  Originally, we had distinct layers that were positioned alongside the camera.  However, we didn't want to nest objects that would be interacting with the game world in a separate clip.  The solution to that problem ended up being adding them to a separate blank tracker during runtime.  That way, all of our references still worked, but we could also drag around a layer and treat it like a single object.

No comments:

Post a Comment