[SOLVED] InstancedModelDrawer refuses to cooperate

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
sergiusz308
Posts: 49
Joined: Mon Oct 08, 2012 4:57 pm

[SOLVED] InstancedModelDrawer refuses to cooperate

Post 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 4739 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?
Last edited by sergiusz308 on Sun Jan 05, 2014 6:30 pm, edited 1 time in total.
sergiusz308
Posts: 49
Joined: Mon Oct 08, 2012 4:57 pm

Re: InstancedModelDrawer refuses to cooperate

Post 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.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: InstancedModelDrawer refuses to cooperate

Post 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.
sergiusz308
Posts: 49
Joined: Mon Oct 08, 2012 4:57 pm

Re: InstancedModelDrawer refuses to cooperate

Post 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 ;)
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: [SOLVED] InstancedModelDrawer refuses to cooperate

Post by Norbo »

I'm sorry, I can't do it- I'm sure your children would learn to forgive, one day :D
Post Reply