Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Physical_Liquid_Brian

Pages: [1] 2 3
1
General support for Liquid Physics 2D / Re: Crash on iOS
« on: March 19, 2015, 11:56:53 am »
I agree this could be some sort of clash. Its not a clash at a 'high level' in unity, the public classes are called 'collider2D' and 'rigidbody2D',
these names do not exist in our Box2D library (rigidbody2d is simply 'B2Body' and collider2d is 'B2Fixture')
What happens to a unity project after it is built however is a bit of a mystery, perhaps they have the original source code for Box2D included in the xcode project somewhere?
You could search the built xcode project for this. (this would be addition to our own liquidfun version of box2d)
If it is a name clash of this nature than you could try editing the C++ source code for iOS in Plugins\iOS and adding all the classes to a namespace, and also add a using statement to the files. In the case of source.cpp (our API layer) I would just add the using statement and not bother adding it to a namespace.
This is a *lot* of work to do. And it may not even help. I'm sorry I cant give any better advice. In fact we are about to release version 1.2 of LP2D and I have been experiencing lots of problems with building to iOS in recent versions of Unity. After lots of testing and trying different things I think that there are recently introduced bugs in either unity or xcode that are causing these issues. I know Unity have been making big changes in this area as they have added IL2CPP compilation. I'm having an issue where if I do a release build to an iOS device it crashes when I call world.Step with this sort of error "Thread 1:EXC_BAD_ACCESS(code=1,address=0x24)" though its fine in a debug build. What errors are you getting in xcode btw? and where are the errors showing up?
We're planning to submit LP2D version 1.2 to the store today and at least initially we will not be supporting iOS because of these new issues.
Rest assured, at least, that I am trying to sort out similar issues and get iOS working or our latest release.

One other thing you could try quickly is try a much older version of Unity, like 4.3 for example.

2
General support for Liquid Physics 2D / Re: PolyFixture, path, holes...
« on: February 23, 2015, 03:44:09 pm »
So box2d doesnt actually allow shapes with holes in them, in fact it doesnt allow concave shapes at all! Various implementations of it (for instance unitys )get around this by making several shapes when a shape is concave or has more than 8 vertices. They also tend to conceal this fact from the user to make life simpler. This is the case with LP2D.
If a poly shape is detected to have more than 8 vertices or be concave then I use PolygonDecomposerAPI.cs to break it up into legal shapes and each one is added to the body as a seperate fixture in the engine.

PolygonDecomposerAPI.cs is actually taken from Farseer, a very nice open source C# implementation of Box2d, you could probably find other useful classes related to what you are doing in there.

If you have a shape with a hole in it you could make it in LP2d by setting the points of a polygon shape according to the attached diagram hole.png

3
General support for Liquid Physics 2D / Re: Vector3 ?
« on: February 23, 2015, 03:16:24 pm »
Good question, if I started LP2D again now I'd probably use Vector 2 for everything.
Before the 2d features for unity came out everything in Unity was vector3 even in 2d games so it is a bit of a habit for me. Also the particle drawer using the ellipsoid particle emitter needs a vector 3 so it was just as handy for me to declare one when I am parsing that data and store is thusly, rather than declaring a new vector 3 as well as a vector2 for every particle when I go to draw them.

One thing that is handy in this case though is that you can implicitly convert between Vector2 and Vector3 in unity. (I didnt know about this when I started the project either)
The following code is fine for example. the z value is either ignored or set as 0

        Vector2 vec2 = new Vector2(1f, 3f);
        Vector3 vec3 = new Vector3(2f, 4f, 6f);

        vec3 = vec2;

        Vector2 vec2_2 = new Vector2(1f, 3f);
        Vector3 vec3_2 = new Vector3(2f, 4f, 6f);

        vec2_2 = vec3_2;

So, this issue shouldnt cause any problems for you.

4
General support for Liquid Physics 2D / Re: Liquids and Destructibe2D
« on: January 29, 2015, 06:20:36 pm »
I dont know why your getting that error. LP2D doesnt use a namespace* and LPFixturePoly is a public monobehaviour derived class.
I honestly have no idea. I've done a little test adding fields of my classes types, to some classes in new random namespaces and it worked fine.

As for your task of making poly shapes programmatically. Have a look at the CreatePolygonsProgrammatically example scene. That shows how to do exactly what you want.

Also as regards making integration of LP2D and other assets easier: A few people have requested this so we are going to add a new feature in the next update (which we are planning to roll out in about a week) Here is my description of it..

http://physicalliquid.com/forum/index.php?topic=53.0

Quote
a simple script that..
goes through all unity 2d physics bodies and fixtures in the scene.
Creates duplicates of them in LP2D.
Then deletes the unity ones.
Might be handy for those wishing to integrate with another asset.

*In hindsight it probably would have been better practice to use one. Though instead I just use a prefix for all the canon (non example) classes

5
General Discussion / Re: Question before I buy
« on: January 20, 2015, 04:17:22 pm »
Yes, more or less. To be specific it includes libraries for various platforms (.dll for windows, .so for android) which are built from liquidfun, which is a superset of Box2d with particle simulation added.
http://google.github.io/liquidfun/
These C++ libraries are accessed as a unity plugin
http://docs.unity3d.com/Manual/Plugins.html
Because you can only pass primitives between C# and C++ there is also a C++ and C# API later that I wrote. So this is the API you will be using and not the default Box2d one, though also I wrote lots of C# helper classes so you can do a lot of stuff in unity just using the GUI.
If you found you need to expose more Box2d functions or whatever you could do that by modifying my API source code (which is included) and build the libraries again. Though no-one has asked me about that on the forums yet.

6
General Discussion / Re: Question before I buy
« on: January 19, 2015, 12:53:26 pm »
Hi! Thanks for you interest! In answer to your questions.

2) Do you have plans to continue development and support for this module?
Yes, we have more planned features and also intend to fix any bugs or issues found asap.

1) Difficult to quantify this. I would say most, if not all, of Box2ds features are exposed, but not every single function is. I tried to expose enough to allow you to make whatever game you want.
The best way to answer this question would be if you listed the functionality you need and I can say whether its there or not.

7
General support for Liquid Physics 2D / Re: Particle drawer
« on: January 16, 2015, 12:34:57 pm »
I explain particle vizualizers in general in this video..
http://youtu.be/cNicq0C6cig?t=6m52s

Briefly, the way the threeColorFoamWeightDrawer works is that it lerps between 3 different colours depending on how high the weight value for the  particle is. So if the weight value is below a certain threshold then its lerping between the low and mid colour and if the value if above a certain threshold its lerping between the mid and high colour.
The code you would want to change if you made a copy of the threeColorFoamWeightDrawer for instance is this bit...

else
{
   //Set the unity particles position bases on the position of the particles in LP2D, you, probably dont need to change this
   particles.position  = partdata.Position;
   
        //determine a brightness value vased on the particles weight, a divisor and an animation curve
   float val = 1- ( curve.Evaluate(partdata.Weight/divisor));
   
        //Based on this value lerp between the appropriate colours
   if (val < threshold)
   {
      particles.color = Color.Lerp(Low,Mid,val/threshold) ;
   }
   else
   {
      particles.color = Color.Lerp(Mid,High,(val-threshold)/(1f-threshold));
   }            
}      

8
Ok, that is weird! If you are getting those 'dll not found' or 'entry point not found' type errors then I would guess that somehow the library "Plugins\liquidfundll.bundle" has been altered or corrupted.
You could try deleting this file and then reimport the library and just reimport that file and move it back to its correct location after import.
Or if that doesnt work delete all the LP2D assets Liquidphysics2d, gizmos,plugins folders and reimport the entire asset then move those 2 folders.

9
General support for Liquid Physics 2D / Re: creating sand
« on: January 14, 2015, 04:06:17 pm »
Yes,
Create a new material (right click in project tab, create\plparticlematerial)
In your newly created materials properties in the inspector panel tick the 'powder' box. Particles with this material will now be basic particles without isotropic pressure.
Assign this material to your particle group (drag it into its material field)
Theres a lot more you can do with materials, you can combine as many of the different materials flags together for instance, I go over it in the tutorial videos.
Hope that sorts you out.

10
Hi BigRedSwitch
Are you running the 64 bit version of the Unity editor? If so try the 32 bit editor.
LP2D does not support 64 bit at the moment though it is a planned feature.
Also, if you are already using the 32 bit editor, another poster on this thread using OSX was able to get it working by changing the build target, so you could try switching it around between the the supported platforms (OSX, windows, Android and iOS)
Hope that helps.

11
Yes thats a good suggestion.. If I were to take into consideration every possible combination of body and fixture and joint + all their various settings it might get quite complicated.
But a simple script that..
goes through all unity 2d physics bodies and fixtures in the scene.
Creates duplicates of them in LP2D.
Then deletes the unity ones.

Might be handy for those wishing to integrate with another asset. What do you think? Weve had some other posts on the forum from someone trying to integrate our asset with Ferr2D.
Also it would be better not do it at runtime but instead in the editor, to save loading times, and so you can tweak the generated bodies and fixtures in the editor.

12
Hmm.. Very interesting! Thanks a lot for the heads up! I will certainly be having a look at that.

13
I dont know anything about Uni2D but I believe you could achieve this, but, it depends on how Uni2D is implemented and may require quite a bit of work on your part re-plumbing it. So, this will definitely not work 'out of the box' as it were.
To clarify, the way LP2D works is it runs its own completely separate physics simulation. It runs Liquidfun  http://google.github.io/liquidfun/
which is a modified version of Box2D. So if you want things to interact directly with particles or anything else in LP2D then it must be in our engine.

Now, I'm assuming Uni2D uses unities 2d physics engine and calls its API for creating bodies and fixtures and so on. In that case you could edit Uni2D or write some kind of wrapper that would redirect these API calls to LP2D.

I've included some methods to make this easier. If you look at the 'CreatePolygonsProgramatically' example scene it shows how to create polygon shaped fixtures and particle groups at runtime programmatically. So you would want to redirect Uni2D to do something like that.

14
Ian,
briefly, theres loads of ways to move a body.. You can just lerp a static body around using LPAPIBody.SetBodyTransform()  Your supposed to avoid this sort of thing in a physics engine but I've found it often works just fine.
The best way to do it imo would be to make a dynamic body and attach it to a random static body using the mouse joint.. See an example in the joints and motors examplescene and also in the testbed weight,velocity and stresstest scenes. In fact the manipulator prefab is exactly an example of this technique. Anyway once you have that set up, the mouse joint has a SetTarget() method that you call, the dynamic bodyB will try and get to that position and will use as much force as you specify in the mousejoints public fields.

The reason for it not working in unity5 is that the libraries are 32 bit. Ive actually already built 64 bit ones that work fine in unity 5 on various platforms and they will be in the next update.
As for turning all the C++ code into C# or javascript.. There would probably be a sizeable performance loss but yeah it would solve several problems for us, most notably the poor performace of native code on iOS. Ive never tried a code conversion tool. I'm assuming that trying to convert the entirety of Box2d + liquidfun would end up being a mammoth task. C++ is very different to those high-level languages. Though, like I said I've never done anything like that so I have no idea. Do you have any experience with this sort of thing? The source is in Plugins\iOS if you want to have a look.

15
Ok, that tablet has an intel atom X86 architecture chip.
When I build my native C++ library for Android I'm building for the armv7 chip architecture.
So, this is a relatively rare issue as there are very few x86 android devices at the moment.

In the most recent versions of Unity there is an option to build for x86 android devices, so I'm guessing they are supported now by unity (we dont have such a device so we cant test atm)

To get this working, I dont know for sure as there is no documentation about this but I would..
try building the library using the NDK and change some build settings so it builds a library for x86 android devices.
Then replace the libliquidfundll.so library in Plugins\Android\ with this new one.

To be honest this is not a priority for us at the moment and it could take us a while to get around to trying this out, we would need to find a test device somewhere aswell.

If you want to try doing this in the meantime here are the instructions on how to build the library for android...
Download liquidfun 1.1
https://github.com/google/liquidfun/releases
Add the file from our asset, Assets\Plugins\iOS\source.cpp , into the box2d project of liquidfun  ( you can just copy it into Liquidfun\Box2D\Box2D\Common  )
Then follow the build instructions for android here..
http://google.github.io/liquidfun/Building/html/md__building_android.html
The easiest method is to to this on a linux machine, install the android SDK and NDK and do this

cd liquidfun/Box2D
ndk-build

So, thats how to build for Armv7. Before you build you might have to muck about in the android manifest xml and other files perhaps in order to get it to build for X86. Something like this..
http://stackoverflow.com/questions/10098049/android-ndk-build-ignoring-app-abi-x86

I will try this myself at some stage and send you a .so file you can try out. In the meantime if you do try it yourself and succeed I'd be grateful if you kept me informed..


Once this is working there is another problem though... You would need seperate apk's for arm or x86 android devices so your apk in the app store would not only work with one architecture. At the moment for desktop plugins in android you can put libraries in special X86 or X64 folders depending on architecture. It dont think such a feature exists for android as the documentation only mentions one folder for android
http://wiki.unity3d.com/index.php/Special_Folder_Names_in_your_Assets_Folder
Maybe this will be fixed in Unity 5. Its another thing for me to investigate.
 

Pages: [1] 2 3