I mapped out the UI on the back of a paper plate and started experimenting. I found out quickly that simply stacking beams (vertical and horizontal) on top of each other and knocking them over didn't look realistic...so I had to try to create the concept of 'welds'. I started using the phys2d engine and they had a variety of joint types that I experimented with. Making a joint 'breakable', however, ended up being a bit of a challenge. In fact, the only joint type that worked was a 'fixed joint' that connected 2 bodies through their center points.
This seemed to work ok in initial tests. In addition to breakable joints, I knew I also needed destructable beams. Regardless of the explosives, when a building collapses, steel twists and breaks so as to create rubble. So I created some techniques to 'split' beams and create 2 new bodies which seemed to work fairly well. Originally I coded this to be based upon sudden changes in speed (when beam rapidly accelerated or decelerated....as the phys2d engine exposed some delta functions (force and movement vectors) for each body.
Experimentation with the physics engine was done and it was time to work on the UI...that's where JavaFX made me smile.
No comments:
Post a Comment