Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Low-level getters/setters changed signatures
#2
(10-05-2019, 10:19 AM)Anoniem Wrote: Hello,

I'd like to manipulate individual particles (of a rope in this case). According to the manual and several forum posts, the Oni.GetParticlePositions/SetParticlePositions/GetParticleVelocities/SetParticleVelocities functions take 4 parameters. In my version (4.1 I think?), they take only two: the solver and a positions IntPtr.

[Image: gb8T4tT.png]

I can't find any reference to this however, and I'd like to know how to pass the positions with this new function signature.

Hi there,

Maybe you're using the old (3.x) manual. In 4.x there's no longer any need for Get/Set operations. They copied data back and forth between managed and unmanaged memory spaces, but that's no longer needed.

In 4.x, memory is shared. There's no longer any overhead associated with getting/setting particle data, and you can access particle data arrays directly:

Code:
// get:
oldPosition = solver.positions[particleIndex];

// set:
solver.positions[particleIndex] = newPosition;

See:
http://obi.virtualmethodstudio.com/tutor...icles.html

PD: The new SetParticlePositions/Velocities/etc() functions are used to tell the unmanaged side: "here, this is the memory where we will be storing particle data for this solver. You can read from it and write to it.". So they only take a solver and a memory pointer as arguments. You should never need to use them unless you're heavily modifying Obi.
Reply


Messages In This Thread
RE: Low-level getters/setters changed signatures - by josemendez - 10-05-2019, 10:30 AM