Sunday, September 23, 2012

Project 2- A new client with a new project


  This time the client is from our own University from Neuroworx. Neuroworx is a licensed physical therapy clinic dedicated to providing innovative, activity-based therapy to individuals with paralysis from spinal cord injuries.

 They have developed a Treadport for people with spinal cord injury. Have a look:


So. this time we are going 3D. We have to develop an environment for the Treadport so that the patient would want to walk on it and thus get over all his fears of walking/running. So, we have decided to do it our ways- A game as a virtual environment where there would be tasks and score and everything just like a Game. We have to use XNA for developing this prototype. So, I started with C# which is what XNA runs. 

 This week's task for me was to work on Collision Detection with various objects. This week is almost over and I've ended up doing more than just collision detection. 

Setting up a Terrain and objects:

  I followed Riemers Tutorials to set up my terrain. I went step by step first creating a list in which I stored the vertices of the triangle. Whatever you want to render has to be in terms of triangles in XNA. For every single block of terrain, I created two triangles which share the hypotenuse, making it a square shape. Many such sqaures one besides another gave me a flat terrain. Similarly, for the objects I created a list and after doing that I used a texture for both terrain and the object giving them a textured look.

Camera Movement and Controller:

   As the game is 3Dimensional we have a First Person Camera view to work on. This single thing took most of my time because it mostly involves trigonometry. The main problem was that I wasn't able to update the camera to the position of that of the avatar. I tried several times to find the angles and then apply sine and cosine but nothing seemed to be working. In this process, I learned about a new concept of yaw, pitch and roll. This made my problem a little less severe. But still it didn't solve my problem because my sins and cosines concepts are a bit rusty.

After a lot of researching I came across a tutorial about Quaternion. Quaternion is a Matrix, in XNA, that stores the rotation of the avatar. PROBLEM SOLVED. Now, all I had to do was store and update the camera's positions and rotations an inch away from our avatar's positions and rotations. No Trig or complex mathematics needed. Done this my to-do list was updated with one more thing- "Brush up your math skills". 

Collision Detection:

This was a cake walk. Unlike other IDEs, I found XNA very lenient when it comes to collision detection. All I had to do was create a bounding sphere for the avatar and a bounding box for the obstacle between which I wanted a collision and check if there is any collision between these two. 

So, after working on all these aspects, the prototype now looks like this: 







Collision occurs when the avatar hits the green building which takes him back to the starting point.

 Pretty low in graphics and blank as a game right? Well, that's what I am going to work on in the next coming weeks.



  

No comments:

Post a Comment