Jump to content
  • Advertisement
Sign in to follow this  
dirtysteve

collision for certain bones only

This topic is 2954 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

This refers to an XNA game built using XEN, I'm asking here as the XEN forums are quiet at the moment, and I believe the problem is a generic enough one. As the name of the post implies, I am working on adding collision spheres to a model with a bone structure. My current code loops through all the bones, and assigns a sphere to each, which is not what I want. My current code,

private void BuildBoundingSphereGeometry()
{
boundingSpheres = new List<IDraw>();

foreach (Xen.Ex.Graphics.Content.MeshData meshData in model.ModelData.Meshes)
{
foreach (Xen.Ex.Graphics.Content.GeometryData geometry in meshData.Geometry)
{
//now loop through all bones used by this geometry
for (int geometryBone = 0; geometryBone < geometry.BoneIndices.Length; geometryBone++)
{
//index of the bone (a peice of geometry may not use all the bones in the model)
int boneIndex = geometry.BoneIndices[geometryBone];

//the bounds of the geometry for the given bone...
Xen.Ex.Graphics.Content.GeometryBounds bounds = geometry.BoneLocalBounds[geometryBone];

//create the cube
boundingSpheres.Add(new Xen.Ex.Geometry.Sphere(new Vector3(3, 3, 3),5));
}
}
}
}


What I would like, is to be able to assign collision volumes with more precision. I may use one for each of the hands, but I don't want one for the forearms, for example. Also, the model contains ik solver bones, as well as others which will never need collision, so culling them from this method makes sense.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!