General

Reply

Using FarSeer Physics with PSSDK. Kinda a tutorial of sorts...

So, there has been a lot of talk about physics engines around here the last few days, that got me off onto a bit of a tangent looking for a physics engine that would work with PS Suite.

 

Box2D seems the obvious choice, but all the wrappers out there except Box2Dx are just wrappers around native code, which simply isn't going to work.  Box2Dx has only a small amount of unsafe code which could probably be ported out pretty easily, but it's fairly dated.  There is another project that seems to be a port of the JBox2D, but it's pretty early.

 

So then I found the XNA based FarSeer library and looked at getting it to work.  I ran into a couple snags.  First it needed to be converted to a PS Suite library obviously, then there was a very minor code change that had to be made to stop it from causing exceptions to be thrown, but after a brief period of time I got it working.

 

 

Anyways, you can head over here to read about how, see some sample code converted for PSS or to simply download the PS friendly DLL.

 

The good news is, yes, there is a working physics engine available for PS Suite.  You do have to jump through a few extra hoops because of the really odd decision to base the origin at the bottom left, but its not a huge mountain to climb.  Also, don't go off my sample for anything more than how to get it running, as I spent exactly six seconds looking in to *how* the Far seer engine works!

 

That would be why my demo app looks like this: :smileyhappy:

 

 

 

 

Anyways, hope some of you find it useful.

 

Cheers.

Please use plain text.

Re: Using FarSeer Physics with PSSDK. Kinda a tutorial of sorts...

Runs horribly on a real device btw, but thats down to me not knowing how to use the library more than anything.  I also edited to add these two lines to make it slightly more interactive:

 

sprite.Schedule( (dt) => {
sprite.Position = new Vector2(circleBody.Position.X,circleBody.Position.Y);
if(Input2.GamePad.GetData(0).Up.Down) circleBody.ApplyLinearImpulse(new Microsoft.Xna.Framework.Vector2(0,10000));
if(Input2.GamePad.GetData(0).Down.Down) circleBody.ApplyLinearImpulse(new Microsoft.Xna.Framework.Vector2(0,-10000));
world.Step(dt);
});

 

 

Please use plain text.

Level 3

Level 3
liquidwater91
Posts: 119
Registered: ‎20-04-2012
Message 3 of 6 (339 Views)

Re: Using FarSeer Physics with PSSDK. Kinda a tutorial of sorts...

That's the issue i ran into as well, works fine in the simulator, but very *****ty on device(or more specifically the vita), i'm curious if you had a problem with the contact solver's Array.Sort?
Please use plain text.

Re: Using FarSeer Physics with PSSDK. Kinda a tutorial of sorts...

No, I only specifically ran into one problem ( the internal method ), but I didn't get that intensive with it.

 

The performance on device though, that's disturbing, I had assumed it was simply my code.

Please use plain text.

Member

Member
DaWolfgang
Posts: 3
Registered: ‎25-04-2012
Message 5 of 6 (297 Views)

Betreff: Using FarSeer Physics with PSSDK. Kinda a tutorial of sorts...

Thank you for your dll! I didn't get Farseer to work by my own.

Finally I can see the Physics work! Yeah! :-)

Please use plain text.

Betreff: Using FarSeer Physics with PSSDK. Kinda a tutorial of sorts...

I also run into this performance issues with Farseer Physics Library.

 

Any sugesstions?

 

Maybe flooting point arithmetic is slow on Vita?

Please use plain text.
This widget could not be displayed.
Announcements

Welcome to the PlayStation Mobile Developer Forums


This is a community for the discussion of technical topics with other developers and SCE engineers. Posting ideas/requests are also appreciated. Join the discussion!

PlayStation®Mobile開発者フォーラムでは世界中の開発者の皆様と一緒に、議論や情報交換が可能です。SCEも議論に参加し、皆様の開発をサポートします。アイデアやリクエストも大歓迎です。ぜひご参加ください。

PSM Developer Registration (for free) on PSM DevPortal is required to post on the forum.
Please sign out then sign in again to the forum and PSM DevPortal after you have completed the registration.

フォーラムへ投稿をするにはPSM DevPortalへの登録(無料)が必要です。
登録後はフォーラムと PSM DevPortalを一度ログアウトし、再度ログインしてください。






Recent News