Obi Official Forum
Collision position related to world - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Rope (https://obi.virtualmethodstudio.com/forum/forum-4.html)
+--- Thread: Collision position related to world (/thread-3158.html)



Collision position related to world - Hoomann - 01-11-2021

Hi there
i just want to know the position of the particle that collides with another gameObject tagged with something.
i have read this page: http://obi.virtualmethodstudio.com/manual/6.2/scriptingcollisions.html#retrievingcollider
but still couldn't manage to do it.
position variable given from code below doesn't seem to be related to world

// do something with the particle, for instance get its position:
var position = solver.positions[particleIndex];



RE: Collision position related to world - josemendez - 01-11-2021

(01-11-2021, 11:10 AM)Hoomann Wrote: Hi there
i just want to know the position of the particle that collides with another gameObject tagged with something.
i have read this page: http://obi.virtualmethodstudio.com/manual/6.2/scriptingcollisions.html#retrievingcollider
but still couldn't manage to do it.
position variable given from code below doesn't seem to be related to world

// do something with the particle, for instance get its position:
var position = solver.positions[particleIndex];

Hi,

As explained in the manual (in the page about particle scripting) all data is expressed in the solver’s local space:

http://obi.virtualmethodstudio.com/manual/6.2/scriptingparticles.html

Quote:  All spatial properties (positions, orientations, velocities, vorticities, etc) are expressed in the solver's local space.

This is because the simulation is also performed in solver space, this is one of Obi’s basic concepts:

http://obi.virtualmethodstudio.com/manual/6.2/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.

Simply transform the data to whatever space you need, using Unity’s Transform functions (TransformPoint, InverseTransformPoint, TransformVector, etc)