I've got a strange issue for my game build where the collisions are not aligning to the models being rendered on screen. The issue is only present on the XBOX and my builds work perfectly on windows. I'm using the integrated BEPU physics and the objects I'm colliding with are Mesh based hulls, no gravity and not marked as active. This was working fine before but has recently stopped in my latest build.
It seems like the collisions and the models aren't in sync because some times I can fly around and now collide in to invisible walls, as if I am colliding with the model I just flew through? (I don't have any code that's meant to let me fly through walls.
As it works on the PC and not on the XBOX I'm not really sure how to trouble shoot?
Are the objects loaded as part of a scene or generated in code? And are they moved at all after being submitted to the ObjectManager?
Let me know if this helps!
Follow me on Twitter – development and personal tweetsAwesome XNA Videos – Lighting, Rendering, and game videos
These objects are loaded as part of the scene & they are never moved.
Its the space station that I am meant to be flying around:
Wow, very cool model. Is it all one mesh? If so it's possible the problem is related to converting high detail meshes to Mesh collision entities. If you add the PhysicsDebugRenderManager to the SceneInterface does it look like parts of the collision mesh are corrupt?
No it's a few different sets of mesh's repeated a number of times.
It does look like one of the collision mesh's is corrupt on the xbox; it doesn't line up with the mesh at all and it's a different shape.
I've attached some screen shots:
This is it working on one group of mesh's
This is the one which isn't working:
This is what I presume is the models collision mesh floating above the actual mesh underneath. Is this what you were referring to when you asked if it was corrupt?
When I took the same screen shots from the PC - everything worked correctly.
Any ideas on how to fix it? The collisions are integral for our game :-)
Wow, why does every game look even cooler with the collision meshes visible? This should be a built-in rendering mode for SunBurn. :)
The collision mesh is definitely in good shape, just in the wrong location. Is it always the same object that's affected? And is it still affected after removing the other objects from the scene?
Are you able to reproduce this with the same object, but in a default starter kit? It would be awesome to have a running example here to debug.
I removed the model from the game and then reimported it. After doing that and rechecking the collision mesh's, everything lines up now in debug. But when I build the game in release mode and run on the xbox I get a Code 4 from: "An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll"
I don't get this error in a release build on windows or a debug build on the xbox. It's triggered when loading the scene where this model was in.
I've spent about 10 hours debugging; removing everything from my game until I could get a release build working on the xbox. I cleared all of the obj folders, rebuild the solution, commented out heaps of the engine and eventually found the issue.
I had to remove another model from the scene and then remove it from the content side of the project. Save the scene, close the game. Then relaunch and import the model from scratch. After doing this; I went back to the version of the build that wasn't working in a release package and just removed that one model, reimported and everything worked - no code changes required.
Took ages to trouble shoot because it was only happening in the xbox release version.
So somehow, it looks like it's possible to get the scene / content repository out of sync to the extent that you can't just rebuild the game for a clean start but need to remove it and re-add models again but only for the xbox release version?
I suspect this is to do with the workflow we were using to make updates to the assets in parallel to the game's development. As the station was built out we had multiple versions of the model. From having no UV's specified, no materials etc. to the final version we are using in the engine. Except at some point, when I had got all of the placements of the models where I wanted them and there were only minor changes, like adding a new material, changing UV locations, small additional structures on the mesh - I would just copy the model in to the content directory over the top of the previous model rather than going through the process of removing all of the instances and then reimporting through the SunBurn editor.
It's just weird that this worked OK for everything except the release build on the xbox. Have you seen this sort of issue previously?
DSebJ:I would just copy the model in to the content directory over the top of the previous model rather than going through the process of removing all of the instances and then reimporting
That's the same workflow we use, and the most ideal for quick updates imo. The only time this doesn't work is when the model is added as separate objects (one for each mesh, instead of all meshes in one object) and new meshes are then added to the model (eg: the new meshes will not have associated objects).
We've never seen this before - normally I would say Visual Studio's cached build files were out of date, but that doesn't sound like the case here.
Did you also delete the bin / obj cache files from within the Content folder? This is where xna stores previously imported assets so only the content processor needs to be run again.
JohnK (WorkingOnTheSite):The only time this doesn't work is when the model is added as separate objects (one for each mesh, instead of all meshes in one object) and new meshes are then added to the model (eg: the new meshes will not have associated objects).
That's probably it. Our models are made of hundreds of mesh objects and we use the Simplify/Optimise Mesh options when importing them in to SunBurn & every change to the models have been adding & removing mesh objects that are part of the model.
I'm not sure if I deleted all of the bin / obj cache in the Content project. I had run the Clean Solution command but didn't check the folders manually.
Any way, for the time being I'll just remove the models from the SunBurn editor before updating.
Nope, that's apparently not it because it's happening again and I've been 100% sure to remove all of the reference, delete the model, save the scene, close and reload - when swapping models.
Here are a new set of screen shots with a different set of models that it's happening to.
See the piping on the left; it's a solid object with a collision mesh. On the right, solid object with a box hull for collision. (These 2 models are from the same FBX file)
Looking up from this position the collision mesh looks to be floating above it & corrupt.
Another example of a corrupt mesh for a piece of track.
The asteroid is also has a collision hull type of mesh but it's not showing up. When I fly in to the centre of the asteroid I see this:
It looks to be a collision mesh from a part of the space station (the space station at the moment has all of it's mesh's aligned).
When I fly out you can see it in the centre still (highlighted in red circle)
However when I run the same in debug mode on the xbox everything aligns perfectly, here's the asteroid:
here is a debug top down view of the track which is also causing issues:
I've deleted all of the bin/obj directories from the main and content projects to ensure that this was a clean build. I've also deleted the previously deployed version from the xbox.
Any ideas why this is happening and only on the release build for the xbox?
So after more investigation I've found that the issue isn't differentiated by Release and Debug per-say but whether or not the debugger is attached when running on the XBOX. I tested this by building a debug version of the game and packagining it up as a creators club package and then deploying that to the xbox. When I run that version of the game I get the same issues as I've described.
Conversely if I set the mode to Release and I set the default game to the XBOX version and then press F5 - the game works as expected on the XBOX.
So is there anything that could be behaving differently because the debugger is attached?
Here's one more screen shot of this happening. I've continued to add instances of the models in to the game and each new instance is having the same problem.
I'm really stuck with this.
Because it's only happening when I deploy to the XBOX and not happening when I am running it from Visual Studio, it means I can't build a package and wont be able to submit the game to Dream Build Play - which would be devastating.
John, I really need some of your magic now :-)
Does it look like the object is using the wrong collision mesh (as opposed to the mesh being in the wrong location or corrupt)? Meaning is the mesh that's used in the correct location (within the bounds of an object), but simply from the wrong model. If so this could be a hashing issue with how the models / meshes are identified and cached by the collision system.
Does the scene use many different models or are all objects using meshes from within the same model?
Btw: when is the DBP deadline?
In one case, it appears it's the wrong mesh (the asteroid example that I highlighted with the red circle) - that one is certainly the wrong mesh in the right location.
For the rail network, I can't be sure if the collision mesh is just corrupt or if it's showing another collision mesh - if it is showing another mesh for the collision - I'm not sure what mesh it is because it doesn't look exactly like any other object I have in the game.
The scene uses about 15 different models. Out of these Models, 4 of the models have about 100 individual mesh's each; however I'm using the options to optimise the mesh's in the content pipeline; then when they are brought in to the scene they are normally only represented as one or two scene objects each.
DBP Deadline is 13 days (Which is why I'm more in need than usual) :-)