Page 2 of 3
Re: sliding collision ?
Posted: Tue Aug 02, 2011 2:39 am
by alfarza
ok firs thing I was scaled down the level form maya It's the best solution for me .
second thing what do you mean with
alfarza wrote: If #3 is happening, set the playerCapsule.LocalInertiaTensorInverse = new Matrix3X3() at initialization.
Re: sliding collision ?
Posted: Tue Aug 02, 2011 2:42 am
by Norbo
Dynamic entities can rotate and fall over. If your capsule is a dynamic entity and you have not already stopped it from doing so, it is falling over. By setting the entity.LocalInertiaTensorInverse = new Matrix3X3(), you are basically giving the entity infinite rotational inertia. In other words, it has infinite 'rotational mass' and nothing can change its angular velocity, and so cannot change its orientation. The result is, it doesn't fall down.
Note that you, as the all-powerful Developer, can still set its orientation when it has infinite inertia. Collisions and constraints, however, cannot.
Re: sliding collision ?
Posted: Tue Aug 02, 2011 2:48 am
by alfarza
you are right ... but my playr now very lazy
ok now how can I use the drawer method and put it in my project ? ( forgive me i'm a beginner in xna teacher )
Re: sliding collision ?
Posted: Tue Aug 02, 2011 3:03 am
by Norbo
1) Download the latest source at
http://bepuphysics.codeplex.com/SourceC ... changesets
2) Look in the bepuphysics\BEPUphysicsDemos\BEPUphysicsDemosContent folder for the InstancedEffect.fx. Right click on the content project in your project and click Add Existing Item. Find the InstancedEffect.fx and add it.
3) You can compile the library using the source you downloaded to get the BEPUphysicsDrawer.dll and BEPUphysicsDrawer.xml if you'd like.
Otherwise, if you're using v0.16.1, then you can download the associated pre-compiled BEPUphysicsDemos demo game from codeplex (
http://bepuphysics.codeplex.com/release ... dId=217237).
In that zip, there are a few files. The BEPUphysicsDrawer.dll and BEPUphysicsDrawer.xml are the two files you want. Put them somewhere easily accessible from your project.
4) Right click on the references in your main project. Click Add Reference and add the BEPUphysicsDrawer.dll reference you compiled/found.
Now for the integration:
5) Create a ModelDrawer. This can be either a InstancedModelDrawer or a BruteModelDrawer. The InstancedModelDrawer requires HiDef profile support.
6) For each entity you want to see in the game, add it to the ModelDrawer using its add method.
7) Call the ModelDrawer's update method from your update method, and call its draw method from your draw method.
An example usage can be found in the BEPUphysicsDemos, or in some of the individual documentation projects, like the Internal Multithreading Demo:
http://bepuphysics.codeplex.com/wikipag ... umentation
Re: sliding collision ?
Posted: Tue Aug 02, 2011 3:20 am
by alfarza
you are great , thanks alot I will try now

Re: sliding collision ?
Posted: Tue Aug 02, 2011 3:36 am
by alfarza
there a Q Norbo the capsule from wich type (model drawer,line drawer or contact drawer ...) and the traingle mesh for level from wich type ? there is alot of things

Re: sliding collision ?
Posted: Tue Aug 02, 2011 3:40 am
by Norbo
Once you make a ModelDrawer (either an InstancedModelDrawer if your computer supports it, or a BruteModelDrawer otherwise), you can add the Capsule entity to the model drawer using the ModelDrawer's add methods. You can add a StaticMesh object directly as well. If you just have a BEPUphysics TriangleMesh object, that is also supported.
For example, a line from the demos:
game.ModelDrawer.Add(staticMesh);
Re: sliding collision ?
Posted: Tue Aug 02, 2011 3:09 pm
by alfarza
ok Norbo I was put the modelDrawer.dll in my ref.. and put the xml file in my project.
and I write the code but there is a problem(the red) :
// statement section
using BEPUphysicsDrawer.Font;
using BEPUphysicsDrawer.Lines;
using BEPUphysicsDrawer.Models;
// ther variables section
ModelDrawer modelDrawer;
// load section
if (GraphicsDevice.GraphicsProfile == GraphicsProfile.HiDef)
modelDrawer = new InstancedModelDrawer(this);
else
modelDrawer = new BruteModelDrawer(this);
modelDrawer.Add(mesh_level);
// update section
modelDrawer.Update();
// the draw section
modelDrawer.Draw(view, projection);
the problem is (TypeInitializerExeption was unhandled The Type initializer for 'Bepu..'...exception)
Re: sliding collision ?
Posted: Tue Aug 02, 2011 8:01 pm
by Norbo
It sounds like the wrong dll might be in use. Are you using the stable release version of v0.16.1? If you copy-pasted the BEPUphysicsDrawer reference from the BEPUphysicsDemos pre-compiled game, then you can verify this by also using the BEPUphyics.dll from that pre-compiled game too.
Another thing to try would be to only try one of the two drawer types at a time to see if it's only one that's having issues.
More details on the exception would help diagnose it (e.g. the stack trace, stored in the exception object).
Re: sliding collision ?
Posted: Wed Aug 03, 2011 12:05 am
by alfarza
I had tried many dll of drawer for example (Ragdoll Demo,bepuphysics-2c8ecb49b881 and MultithreadingDemo) same problem can I replace the code :
if (GraphicsDevice.GraphicsProfile == GraphicsProfile.HiDef)
modelDrawer = new InstancedModelDrawer(this);
else
modelDrawer = new BruteModelDrawer(this);
with another code and what about the xml file .

Re: sliding collision ?
Posted: Wed Aug 03, 2011 12:12 am
by Norbo
Try just creating a BruteModelDrawer alone. You do not need to check for HiDef to make a BruteModelDrawer. If there's still an exception, copy paste the details/stack trace of it up here. That will make it easier to diagnose.
Also, make sure the correct platform dlls are being used. Using an Xbox360 compiled .dll will not work on Windows and vice versa.
Re: sliding collision ?
Posted: Wed Aug 03, 2011 12:32 am
by alfarza
ok I used one line "modelDrawer = new BruteModelDrawer(this);" and there is anothor error
I then used the line "modelDrawer = new InstancedModelDrawer(this);" and same error

- bepu2.jpg (114.1 KiB) Viewed 8004 times
Re: sliding collision ?
Posted: Wed Aug 03, 2011 12:34 am
by Norbo
That one's a bit easier to fix
There's a bunch of texture files in the BEPUphysics content, where you got the InstancedEffect.fx- I just forgot about them the first time around. Add the whole Textures folder to your content project, not the individual files; the Textures subfolder is where the content loader will look.
Re: sliding collision ?
Posted: Wed Aug 03, 2011 12:58 am
by alfarza
YES ..YES it's work Norbo I can see the capsule
Norbo I have many Q in my mind I don't konw to post it here or with another subject title ? many many many Q

Re: sliding collision ?
Posted: Wed Aug 03, 2011 1:02 am
by Norbo
If it's an unrelated topic, starting a new thread would probably be best so people searching can figure out what it's about at a glance
