Monday, March 4, 2013

Day 170

Now at this point I thought I was done with the book. But instead of the usual "good luck with your future endeavors" at the end, I saw "in the next chapter, you'll learn..." instead followed by the index. Turns out there are more chapters in PDF form in the books supplemental files that go on for about another 150 pages. Kind of a downer.  Anyway, the next chapter had to do with physics and objects crashing into each other known as dynamics.


By default, objects don't interact with each other when they collide. You can see in the last video that the dog's elbow goes right through one of the lampposts. But you can easily change that. I can turn objects into active or passive rigid bodies. Active means that they'll bounce around and react with things. Passive means that active bodies with react with them but they don't move themselves like the ground. In the scene, I made the ground and a few of the buildings passive and the trash active. Now I finally know why the book had me make the garbage 500 pages ago. The scooter should be active as well but to simplify things, I made a shape to represent the scooter and made that active instead.


Now the scooter shape crashes into the trash and sends it flying. Not quite that realistic as you can see above. So I have to create a gravity field and have that influence the trash. Then I can hide the scooter shape and render out the scene. There are a lot of variables to tweak as usual like the objects' mass, bounciness, friction, etc. Here the trash bags don't really move like bags but it's good enough.

video

No comments:

Post a Comment