Posts: 4
Threads: 1
Joined: Apr 2020
Reputation:
0
Hi there,
I hope there isn't already a thread for this. If so I probably wasn't clever enough to search for the right thing.
I am trying to implement a 2D Simulation but in a 3d environment. The problem is, everytime I try to add a Solver and Emitter the particles don't behave like they should. None of the colliders work (2d or 3d) and the particles just fly straight through the objects.
I tried copying some of the sample scenes into my project and they do work if they haven't been moved from x,y,z = 0,0,0. Once I move them to another place in the environment the problem starts.
I would really appreciate some help since I already worked way to many hours trying to solve this.
Best wishes,
Klaas
Posts: 6,321
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
(01-04-2020, 10:54 AM)Klaas Wrote: Hi there,
I hope there isn't already a thread for this. If so I probably wasn't clever enough to search for the right thing.
I am trying to implement a 2D Simulation but in a 3d environment. The problem is, everytime I try to add a Solver and Emitter the particles don't behave like they should. None of the colliders work (2d or 3d) and the particles just fly straight through the objects.
I tried copying some of the sample scenes into my project and they do work if they haven't been moved from x,y,z = 0,0,0. Once I move them to another place in the environment the problem starts.
I would really appreciate some help since I already worked way to many hours trying to solve this.
Best wishes,
Klaas
Hi Klaas,
I'm unable to reproduce this, moving the scenes around makes no difference as far as collisions goes.
Keep in mind that if you move the scene very far from the origin, you might encounter floating point precision issues. This is specially noticeable with rigidbody rotation, as their center of mass is expressed in world space. To circumvent this, keep the solver object at the origin, and then move the rest of the scene.
Posts: 4
Threads: 1
Joined: Apr 2020
Reputation:
0
Hi Jose,
I'll add a few screenshots to explain it.
I used the Karman Fluid Sample-Scene as an example. It was copied to another scene and moved there.
As soon as I move the Emitter on the Z-Axis the Colliders don't work anymore.
The Particle system from the sample scene also just works in the coordinate origin.
Here is the Emitter in its original position:
Here I moved it up on the Y-Axis a bit. It seems like there is a window in which the Particle system works.
Here I moved it on the Z-Axis. No Collisions, no particle system.
Do you know if there is any workaround? I could build my scene around the emitter, but I would need more than one and then I would only be able to have one Particle system.
Thanks a lot and best wishes,
Klaas
Posts: 6,321
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
02-04-2020, 08:54 AM
(This post was last modified: 02-04-2020, 08:56 AM by josemendez.)
Hi Klaas,
If you move the emitter on the Z axis, collisions stop working because the particles stop touching the colliders (they're 3D spheres and boxes, so they have a limited span in all 3 axis). This is how it's supposed to work, of course. Maybe if you rotate the camera the cause will be apparent:
Also, the advected particles (the colored ones, a standard Unity particle system) can only be advected if they're close to a fluid particles. So if you take the fluid emitter away, they will stop being advected and stay in place, like in your last 2 screenshots. Again this is the correct and expected behavior. See:
http://obi.virtualmethodstudio.com/tutor...ction.html
Quote:Regular Unity particle system, placed on top of the fluid emitter. This way particles will be close enough to the fluid for it to advect them.
Posts: 6,321
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
02-04-2020, 09:01 AM
(This post was last modified: 02-04-2020, 09:02 AM by josemendez.)
Note though, that colliders in a 2D particle system only work in a narrow band along Z = 0. If you take the entire scene (not only the emitter) away in the Z axis, they will stop working.
Posts: 4
Threads: 1
Joined: Apr 2020
Reputation:
0
(02-04-2020, 09:01 AM)josemendez Wrote: Note though, that colliders in a 2D particle system only work in a narrow band along Z = 0. If you take the entire scene (not only the emitter) away in the Z axis, they will stop working.
Hi, this kind of helped!
I moved the entire scene closer to the z-axis and will put all 2D Emitters on that axis. Not the most beautiful solution, but that shouldn't be a problem.
Nonetheless, the colliders still act strangely. When I start the Game the colliders don't work. If I move the entire gameobject (colliders, emitter and so on) on the z-axis, the colliders work. If I move it back to where it started, it still works! Any ideas where this is coming from?
Greetings,
Klaassum
Posts: 4
Threads: 1
Joined: Apr 2020
Reputation:
0
Hi,
so for some reason the issue from my last post disappeared, but now I'm trying to get the Particle system to work.
I scaled everything up, but the moving particles from the particle system stay in the small scale from before.
I start to feel stupid for all the things I'm asking, but I really tried to get it done. I've got no idea why this doesn't work.
Thanks and best wishes,
Klaas
Posts: 6,321
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
11-04-2020, 04:38 PM
(This post was last modified: 11-04-2020, 04:49 PM by josemendez.)
(11-04-2020, 03:29 PM)Klaas Wrote: Hi,
so for some reason the issue from my last post disappeared, but now I'm trying to get the Particle system to work.
I scaled everything up, but the moving particles from the particle system stay in the small scale from before.
I start to feel stupid for all the things I'm asking, but I really tried to get it done. I've got no idea why this doesn't work.
Thanks and best wishes,
Klaas
Hi Klaas,
This is actually a bug, caused by diffuse particles being passed to the engine in world space, while it expects them in solver space. It has been corrected in 5.3, which we uploaded to the store a couple days ago. If it isn't live now it should be very soon.
Keep in mind though that Unity's ParticleSystems have several scaling modes, each of them behaves differently. The one by default (local) does not behave like you seem to expect: it ignores scale values dictated by the object hierarchy. Setting the scaling mode to hierarchy will allow the particle system to inherit the scale of parent objects. In addition to our bug, this may be interfering with you getting the results you're after.
Also, we squeezed a slight adjustment in 5.3 that makes 2D colliders extend infinitely in the Z axis, for better consistency with how 2D colliders in Unity work. Thought you'd appreciate this based on your previous questions
|