Oops! with my own models!

Apr 10, 2009 at 3:46 PM

I'm a newbie with XNA and Oops framework. I downloaded your code source, made a few changes to better understand how it works. I kept only two spheres and the plane. I'm now controlling each spehere with the keyboard and I want to change them to my own models. 
I have a fuzzy idea how can I make it happen! At some point you use a CollisionSphere and you give the class Sphere as a draw helper, is it correct? How can i change the class spehere to draw my one model (and use spheres as boundingbox/collision)? Or, do you have any other method to user a mesh collision? Do you have any working example?

Thank you for your support,
Sorry about all these questions are for some error with my english.

Best regards

Gabriel Blanco
Apr 11, 2009 at 10:01 PM
Hi Gabriel,

You are correct that the CollisionSphere class is the physical representation of a sphere in the physics engine and the Sphere class is just a helper to draw a sphere.  You can use a Microsoft.Xna.Framework.Graphics.Model class created from the content pipeline instead of the Sphere class when you want to draw the object represented physically by a CollisionSphere just as well.

My suggestion would be to associated the RigidBody class with the Model class (Model.Tag? or some new class) and when drawing the Model, look to the RigidBody.Position and RigidBody.Orientation fields to create the "World" matrix or transform of your Model.  You may have to add a bit of translation to this "World" matrix if the model's center doesn't match with CollisionSphere's.

Good luck!  Let me know if you have any other questions.