Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Switching between 3D and 2D mode in runtime?
#2
(02-05-2019, 02:46 PM)Yelmer Wrote: Is there any way to swap between 2D and 3D mode on a obi solver (fluids) in runtime? I am trying to access the variable/parameter trough scripting, but I can not find a "Mode" on the Obisolver. Either I am looking in the wrong place - or the answer is "no you can not"? Sonrisa

And since someone always asks "Why would you want to do that" let me clarify that I understand I can not do both 2d and 3d at the *same* time.  Guiño 
It just would like using the same one solver and swap between 3d and 2d mode and keep all other settings - instead of setting up another one and point emitters back and forth and make sure all things match up. It is a visual effect thing that happens in between some other things in a visual art thing.

Hi there,

Just do:

Code:
solver.parameters.mode = <2D or 3D>
solver.UpdateParameters();

See:
http://obi.virtualmethodstudio.com/api.html

Note however, than when switching from 3D to 2D existing particles won't be projected back to a common 2D plane. Each one will continue simulating in their own plane, centered at their current Z coordinate. You might want to loop trough all of them setting their Z to 0 (or whatever value you need it to be, so that they all share the same 2D plane).

Switching from 2D to 3D, no special care needs to be taken Sonrisa
Reply


Messages In This Thread
RE: Switching between 3D and 2D mode in runtime? - by josemendez - 03-05-2019, 03:40 PM