Some problems

13 views
Skip to first unread message

slgee...@hotmail.com

unread,
Dec 29, 2010, 4:59:13 AM12/29/10
to Physics2D.Net
Goodday,

For school I have to make an assignment, and it includes some physics,
as well as some other things. When searching for an easy physics
engine I found this, looked at the demo, and it looked awesome!
So I tried to add it to my own project, but as I'm new to C# (have
some C and Java knowledge) its not that easy.
And there are some problems with the source-code of the demo's as
well.

First off al I can't run the demo. When I try to run the DemoRunner, I
get an TypeInitializationException error, made by the class Window, in
Graphics2DDotNet, on line 88. It has something to do with the Sdl
library, as it's keeps giving errors of the same kind if I comment the
error-giving parts...
Secondly, when I start a new project, and follow the BasicIntroduction
and the first (and only?) tutorial from the Wiki, neither are working.
Basic because theres nothing to show (and Ive no idea how to do that)
and the tutorial because it cant find the renderer, and neither can
I...
Third, there are some files in the Downloadmap, that aren't working,
like the Tutorial files...

Well, and about the project I want to make:
I use the webcam to see some objects on a white screen. The objects
are recognized, and I can make a Bitmap with just the objects I want.
Now I want to use those objects to virtually get a ball bounce on
those objects. So a virtual ball, bouncing on real life objects.
So I want to use the Bitmap to shapes method to get the background,
and then play with it. But its not that easy, sadly :P

So, I hope u can give me some more information on how to run the
Physics engine, and how to get the DemoRunner working...

Thanks in advance,
SLGeertsema

slgee...@hotmail.com

unread,
Dec 29, 2010, 5:04:13 AM12/29/10
to Physics2D.Net
Owh, and what I forget: Im using Visual Studio 2010, C#, on Windows 7.
So I had to upgrade the code, but I dont think that would be the
problem...


On 29 dec, 10:59, "slgeerts...@hotmail.com" <slgeerts...@hotmail.com>
wrote:

JonoPorter

unread,
Dec 30, 2010, 1:10:42 PM12/30/10
to Physics2D.Net
Did you get the source code from the SVN or the download link?
I would recommend getting from the SVN.
Also there is a setting in Build called Platform target. when using
the demo that should be x86. (that should hopefully fix the sdl
issues)
Well you not going to have a real easy time with your project thats a
lot of work regardless of what engine you use.
The demo was meant to be a tutorial.

You can modify the demo to add your project that can save you some
time.

On Dec 29, 3:04 am, "slgeerts...@hotmail.com"

slgee...@hotmail.com

unread,
Dec 30, 2010, 1:52:37 PM12/30/10
to Physics2D.Net
The download link, I think.

Yeah, that fixed the sdl problem, thank you!
So the demo is working perfectly now. Thx :)

Well, now its working I can go on and try to find out the rest.
Thanks!
I'll let u know if I run into more problems...

slgee...@hotmail.com

unread,
Jan 3, 2011, 10:07:06 AM1/3/11
to Physics2D.Net
Okay, Ive played some more with it, and I understand better now.

But Ive another question.
What I try to achieve: Ive a Bitmap (System.Drawing), with some
objects on it (made with some sort of edge-detection from a webcam
image) and I want to get that Bitmap into the physics engine. Ive
tried by saving the Bitmap, and loading, and it works.
But I want to skip the save part, and load it immediately.
I achieved it in the old demo, but Id hope to do it in the new one as
well. But I dont understand what happens there... Is it possible to
adjust that, so it also works with Bitmap, instead of files? And if
so, how fast will it be?

I hope u understand what I mean :$



On 30 dec 2010, 19:52, "slgeerts...@hotmail.com"

JonoPorter

unread,
Jan 3, 2011, 12:06:21 PM1/3/11
to Physics2D.Net
well the slowest part is the pixel by pixel testing of the image
usually.
I would just make a copy of the method that makes the body off of the
image file and change it so instead of a filename you pass the bitmap.
my have to write your own code that will analyze the bitmap for
collision/no collision.

On Jan 3, 8:07 am, "slgeerts...@hotmail.com" <slgeerts...@hotmail.com>
wrote:

slgee...@hotmail.com

unread,
Jan 3, 2011, 12:31:14 PM1/3/11
to Physics2D.Net
Yeah, I thought so too, but the problem is that I dont understand how
that works. The closest demo to that is the BallMachineDemo. In there
the file is taken, and than this makes the objects: SurfacePolygons
surfacePolygons =
Cache<SurfacePolygons>.GetItem("physicsplayGround.png");
But how does that work? Or where can I change it to the bitmap? Cause
simply changing the argument to the bitmap doenst work. And in the
'Cache' Class, I dont really understand what happens.

slgee...@hotmail.com

unread,
Jan 5, 2011, 10:53:30 AM1/5/11
to Physics2D.Net
Okay, I got it working now. Thx!!

One last question (I hope):
I'd wonder if it is possible to make a loop, what removes and adds the
background. Cause when I use a timer, it'll stop after 1 or 2 seconds,
an infinite loop doesn't let the engine start...
What I mean by background, is the loaded image from the webcam, loaded
and transformed into the engine.

On 3 jan, 18:31, "slgeerts...@hotmail.com" <slgeerts...@hotmail.com>
wrote:

slgee...@hotmail.com

unread,
Jan 20, 2011, 9:03:14 AM1/20/11
to Physics2D.Net
Well, it works now!
Thanks for the help :)

On Jan 5, 4:53 pm, "slgeerts...@hotmail.com" <slgeerts...@hotmail.com>
wrote:
Reply all
Reply to author
Forward
0 new messages