Obi Official Forum
Help Solver Rotation - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Fluid (https://obi.virtualmethodstudio.com/forum/forum-3.html)
+--- Thread: Help Solver Rotation (/thread-3343.html)



Solver Rotation - 0xhex - 02-03-2022

Hello,my solver is inside the game object, when I rotate the game object also emitted particles are rotating around the game object.

Is there any solution about it?

 I need to use emitter inside the game object because when I rotate the character also emitter should rotate. solver does not work if emitter is not child of solver.

Please check the video.


RE: Solver Rotation - josemendez - 02-03-2022

This is a basic concept in physics (and games in general): vector spaces.

Obi performs simulation in the solver's local space, as explained in the manual. This has many advantages (ability to control inertial forces, no floating point precision issues away from the world origin, ability to simulate in spaces other than world space, etc):
http://obi.virtualmethodstudio.com/manual/6.3/obisolver.html

Quote:Solvers always perform the simulation in local space. This means that translating, rotating or scaling the solver will rigidly transform the simulation as a whole.

The solution in simple: place the solver above your character in the hierarchy. You might as well place it in your scene at 0,0,0 to get the simulation be performed in world space. Then you will be able to rotate your character and the emitter without the simulation space being rotated too.

Think about the solver like the "world" of your simulation: if you rotate the world, everything within it will rotate too (in this case, the fluid). In your game, your character and the emitter are part of the world so they should be inside of it (below the solver in the transform hierarchy).


RE: Solver Rotation - 0xhex - 02-03-2022

(02-03-2022, 10:27 AM)josemendez Wrote: This is a basic concept in physics (and games in general): vector spaces.

Obi performs simulation in the solver's local space, as explained in the manual. This has many advantages (ability to control inertial forces, no floating point precision issues away from the world origin, ability to simulate in spaces other than world space, etc):
http://obi.virtualmethodstudio.com/manual/6.3/obisolver.html


The solution in simple: place the solver above your character in the hierarchy. You might as well place it in your scene at 0,0,0 to get the simulation be performed in world space. Then you will be able to rotate your character and the emitter without the simulation space being rotated too.

Think about the solver like the "world" of your simulation: if you rotate the world, everything within it will rotate too (in this case, the fluid). In your game, your character and the emitter are part of the world so they should be inside of it (below the solver in the transform hierarchy).


Yes but when I put outside the solver,

emitter's position and rotation is not changed by character position and rotation right?
so I need to update its position and rotation every frame?  or there is some shortcut for example solver outside character, emitter inside the characters that possible?

when I cancel the parent relationship solver and emitter, it does not work,
emitter has to be inside to solver?



RE: Solver Rotation - josemendez - 02-03-2022

(02-03-2022, 10:06 AM)0xhex Wrote: Yes but when I put outside the solver, emitter's position and rotation is not changed by character position and rotation right?

Why wouldn't it? as long as the emitter is a child of the character (at any nesting level), emitter position and rotation will be that of the character's. It's just how transform parenting works.


(02-03-2022, 10:06 AM)0xhex Wrote: so I need to update its position and rotation every frame? 

No need, parenting the emitter to the character will take care of that.

(02-03-2022, 10:06 AM)0xhex Wrote: or there is some shortcut for example solver outside character, emitter inside the characters that possible?

That's exactly what you should do: place the emitter inside the character, and the character inside the solver:

Solver --> Character ---> Emitter

Quote:when I cancel the parent relationship solver and emitter, it does not work,
emitter has to be inside to solver?

Any actors (including emitters) need to be inside the solver's hierarchy. Quoting the manual:
http://obi.virtualmethodstudio.com/manual/6.3/obisolver.html

Quote:Every actor needs to have a solver up its hierarchy in order to get updated and rendered.

Also check the page that explains Obi's architectural design: http://obi.virtualmethodstudio.com/manual/6.3/bigpicture.html

To draw a parallelism with other systems in Unity:

UI: Buttons needs to be inside a Canvas to be rendered and receive events.
Animation: joints need to be inside an Animator to have their position/rotation driven by it.
Obi: Actors need to be inside a Solver to be rendered and have their simulation updated.


RE: Solver Rotation - 0xhex - 02-03-2022

Yeah Works!
Thank you!