Page 1 of 1

[SOLVED] InstancedModelDrawer refuses to cooperate

Posted: Sat Jan 04, 2014 12:11 pm
by sergiusz308
Hi, Norbo, I just switched to new machine and VS2013 and bepu demos are working okay, but in my "hello world" physics project I'm experiencing a little problem with InstancedModelDrawer - id doesn't draw anything...

Code, based on BEPU demos code:

Code: Select all

// inside LoadContent
this.space = new BEPUphysics.Space();
this.md = new BEPUphysicsDrawer.Models.InstancedModelDrawer(this);

this.space.Add(new BEPUphysics.Entities.Prefabs.Box(new BEPUutilities.Vector3(0, 0, 0), 2, 2, 2));
this.space.Add(new BEPUphysics.Entities.Prefabs.Sphere(new BEPUutilities.Vector3(0, 3, 0), 2));


foreach (BEPUphysics.Entities.Entity e in this.space.Entities)
{
	this.md.Add(e);
}

// inside Update
this.space.Update();
this.md.Update();

// inside Draw
BEPUutilities.Matrix view2 = BEPUutilities.Matrix.CreatePerspectiveFieldOfViewRH(MathHelper.PiOver4, this.GraphicsDevice.Viewport.AspectRatio, 1, 100);
BEPUutilities.Matrix proj2 = BEPUutilities.Matrix.CreateLookAtRH(new BEPUutilities.Vector3(0,0,3), BEPUutilities.Vector3.Zero, BEPUutilities.Vector3.Up);

this.md.Draw(view2, proj2);
Here's how it looks in pix:
bepu_md_pix.jpg
bepu_md_pix.jpg (23.54 KiB) Viewed 9066 times
Weird thing - I can't see effect file source in PIX, other custom shaders are working fine.

To the Content project I've added everything that Demos Content has.

System, gpu drivers are all up-to-date... am I missing something?

Re: InstancedModelDrawer refuses to cooperate

Posted: Sat Jan 04, 2014 12:45 pm
by sergiusz308
Update: version 1.2 bepu works fine - prefabs are drawn as expected, so it seems there's something odd happening in 1.3.

Re: InstancedModelDrawer refuses to cooperate

Posted: Sat Jan 04, 2014 6:17 pm
by Norbo
The view matrix given to the Draw function appears to be a projection matrix, and the projection matrix appears to be a view matrix.

Re: InstancedModelDrawer refuses to cooperate

Posted: Sun Jan 05, 2014 6:29 pm
by sergiusz308
I can't believe it I made a post about it... Norbo, please, kill this post - my children could stumble upon it some time and find out the TRUTH about their father ;)

Re: [SOLVED] InstancedModelDrawer refuses to cooperate

Posted: Sun Jan 05, 2014 10:47 pm
by Norbo
I'm sorry, I can't do it- I'm sure your children would learn to forgive, one day :D