Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Collision position related to world
#1
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/manua...ngcollider
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];
Reply
#2
(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/manua...ngcollider
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/manua...icles.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/manua...olver.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)
Reply