Showing posts with label Physics. Show all posts
Showing posts with label Physics. Show all posts

Tuesday, September 10, 2013

Update 17: Alpha 1.45 - Explosive Walls

I've been working on destructive terrain, and I decided the best way to blow up something, is to build it up first, literally brick by brick. As my current walls were just a (1,0.5,0.1) sized wall, I figured I should build it with 50 individual bricks into a prefab. Then when I apply force to it, it will spray across the screen in 50 pieces not one!




My first hurtle was that when I applied the rigid body property to all of the bricks, the wall tended to wobble like jelly (Jello for you Americans). I was able to solve this by not applying my RigidBody component (to enable physics) until the explosive force was applied. It actually turned out to be easier to apply this component to items in the blast radius rather than every single item on the screen. It's probably cheaper, (resource wise), too!

Next it was time to stack a few of these prefabs on top of each other, and then apply an explosive force to a random point in front of the wall... the resultant explosion was... unexpected. I'm still not sure why the explosion is along the z plane...




Moving on, applying the new prefab to my test level, it gives a far more satisfying burst across the screen when I throw grenades.




There is no download for this, I'm still adding some the next feature... which is visible in that last screenshot...

Friday, February 15, 2013

Update 7: Pathfinding

I need to be able make my players move from point A to point B, avoiding any objects on the way. This is basic pathfinding. Pathfinding is one of those simple features that seems to be difficult to do properly. There are plenty of games that just don't quite get it right. Taking this into account, I knew I wouldn't be writing mine from scratch.

I analyzed a number of different tools, before selecting the A* Pathfinding Project. I found this project both really simple to use... and difficult to use. The primary problem I was having was that my character was stopping half way towards his destination. The sample wasn't quite right and I pulled my hair out for a few days, still unable to get it to work. 

I added in some basic movement, but my player kept hitting walls and falling over (shown below). While hilarious, it wasn't the result I was looking for. It turned out to be a physics problem. While my pathfinding is not complete, I was a good introduction and I did have some positive results (not shown below).