Posts: 38
Threads: 8
Joined: Sep 2018
Reputation:
0
18-08-2019, 05:33 PM
(This post was last modified: 18-08-2019, 06:15 PM by arrnav96.
Edit Reason: Added details
)
Hi, I've been using an older version of Obi Cloth which has the older API for getting particle positions, velocities, etc.
As this project is for a client, meaning it's time sensitive, doing a complete upgrade to the newer 4+ API does not seem to be possible as this project has 100+ Obi actors with their own cloth settings tuned to perfection.
Now the issue is, Google Play has made 64-bit support in apps mandatory recently, meaning I had to now turn on ARM64 as well (Along with already enabled ARMV7) while building the APK.
The project's actors all render fine inside the editor, but upon building to an Android device none of the actors render at all and the logcat shows that the Oni DLL could not be found or loaded.
Looking deeper into the Obi/Plugins folder, I briefly compared my current Plugins folder contents with the new 4+ Obi's Plugin folder and understood that only the newer version has ARM 64-bit support.
To confirm the issue, I built without the ARM64 option enabled and the build rendered actors correctly, confirming that Unity was previously unable to find a 64-bit supporting DLL plugin for Oni.
Tldr; Is there any way I can simply add ARM64 support to existing Obi cloth setup without actually upgrading the API/Updating Obi plugin?
Simply updating the package would mean multiple weeks of added work due to requiring re-initializing and re-tuning all actors, completely halting productivity in such a large project.
EDIT: I now tried using a copy of this project to update to latest Obi package, then set up a temporary actor - fully initializing it, then enabled 64-bit ARM option and built APK to device.
Still the same problem - The correctly set up Obi actor doesn't render at all and throws the same errors as before. Looks like this issue is something other than just 64-bit support from Obi/Plugins folder.
This is the constantly recurring DLL error I get when I try to enable 64-bit and build, regardless of the version of Obi cloth I used on device (Using Unity 2019.2.1f1) -
[attachment=389]
Posts: 6,326
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
19-08-2019, 01:38 PM
(This post was last modified: 19-08-2019, 01:40 PM by josemendez.)
(18-08-2019, 05:33 PM)arrnav96 Wrote: Hi, I've been using an older version of Obi Cloth which has the older API for getting particle positions, velocities, etc.
As this project is for a client, meaning it's time sensitive, doing a complete upgrade to the newer 4+ API does not seem to be possible as this project has 100+ Obi actors with their own cloth settings tuned to perfection.
Now the issue is, Google Play has made 64-bit support in apps mandatory recently, meaning I had to now turn on ARM64 as well (Along with already enabled ARMV7) while building the APK.
The project's actors all render fine inside the editor, but upon building to an Android device none of the actors render at all and the logcat shows that the Oni DLL could not be found or loaded.
Looking deeper into the Obi/Plugins folder, I briefly compared my current Plugins folder contents with the new 4+ Obi's Plugin folder and understood that only the newer version has ARM 64-bit support.
To confirm the issue, I built without the ARM64 option enabled and the build rendered actors correctly, confirming that Unity was previously unable to find a 64-bit supporting DLL plugin for Oni.
Tldr; Is there any way I can simply add ARM64 support to existing Obi cloth setup without actually upgrading the API/Updating Obi plugin?
Simply updating the package would mean multiple weeks of added work due to requiring re-initializing and re-tuning all actors, completely halting productivity in such a large project.
EDIT: I now tried using a copy of this project to update to latest Obi package, then set up a temporary actor - fully initializing it, then enabled 64-bit ARM option and built APK to device.
Still the same problem - The correctly set up Obi actor doesn't render at all and throws the same errors as before. Looks like this issue is something other than just 64-bit support from Obi/Plugins folder.
This is the constantly recurring DLL error I get when I try to enable 64-bit and build, regardless of the version of Obi cloth I used on device (Using Unity 2019.2.1f1) -
Hi there,
Which Obi version are you currently using? we can build a 64 bit arm version of the physics engine for that specific version. Note that copying the 4.0 library directly on a previous version won't work and will result in a DllNotFound exception.
kind regards,
Posts: 38
Threads: 8
Joined: Sep 2018
Reputation:
0
(19-08-2019, 01:38 PM)josemendez Wrote: Hi there,
Which Obi version are you currently using? we can build a 64 bit arm version of the physics engine for that specific version. Note that copying the 4.0 library directly on a previous version won't work and will result in a DllNotFound exception.
kind regards,
I was on version 3.5 then upgraded to 4.1.
I was recently able to update to 4.1 without losing actor states. How I did this was -
- Firstly closed the Unity project window.
- Backed up, then deleted old Obi folder. Also backed up "ObiClothPicker.cs" and "ObiClothDragger.cs" from old folder, which seemed to be missing from the new version folder.
- Copied and pasted the new Obi folder in the same project location.
- Copied and pasted the two cs files previously backed up.
- This was important, I copied all the .meta files from old Obi folder into the new one, placing them next to their respective files within Obi folder.
- As I was hoping, Unity remembered the states of all previous Obi scripts as it is and hence remembered their settings (Constraints, etc.) for every already initialized actors. Tested the actors and all worked like before.
- Built the game to device and it worked as now we had the 64 bit library as well!
The only issue left now (As the particle system API has changed vastly I presume), is that I am left with about 4 errors in the ObiClothDragger class. This is the script -
Code: using UnityEngine;
namespace Obi
{
[RequireComponent(typeof(ObiClothPicker))]
public class ObiClothDragger : MonoBehaviour
{
public float springStiffness = 50;
public float springDamping = 1;
private ObiClothPicker picker;
private ObiClothPicker.ParticlePickEventArgs pickArgs;
public float FingerDepthDurationFactor = 1.5f;
void OnEnable()
{
picker = GetComponent<ObiClothPicker>();
picker.OnParticlePicked += Picker_OnParticlePicked;
picker.OnParticleDragged += Picker_OnParticleDragged;
picker.OnParticleReleased += Picker_OnParticleReleased;
}
void OnDisable()
{
picker.OnParticlePicked -= Picker_OnParticlePicked;
picker.OnParticleDragged -= Picker_OnParticleDragged;
picker.OnParticleReleased -= Picker_OnParticleReleased;
}
void FixedUpdate()
{
if (pickArgs != null)
{
ObiSolver solver = picker.Cloth.Solver;
// Calculate picking position in solver space:
Vector3 targetPosition = pickArgs.worldPosition;
if (solver.simulateInLocalSpace)
targetPosition = solver.transform.InverseTransformPoint(targetPosition);
// Get particle position and velocity:
Vector4[] positions = new Vector4[1];
Vector4[] velocities = new Vector4[1];
int solverIndex = picker.Cloth.particleIndices[pickArgs.particleIndex];
Oni.GetParticlePositions(solver.OniSolver, positions, 1, solverIndex);
Oni.GetParticleVelocities(solver.OniSolver, velocities, 1, solverIndex);
// Calculate effective inverse mass:
float invMass = picker.Cloth.invMasses[pickArgs.particleIndex] * picker.Cloth.areaContribution[pickArgs.particleIndex];
if (invMass > 0)
{
// Calculate and apply spring force:
Vector4 force = (((new Vector4(targetPosition[0], -targetPosition[1], targetPosition[2], 0) - positions[0]) * springStiffness - velocities[0] * springDamping) / (invMass)) * (picker.durationsTouch / FingerDepthDurationFactor);
Oni.AddParticleExternalForce(picker.Cloth.Solver.OniSolver, ref force, new int[] { solverIndex }, 1);
}
}
}
void Picker_OnParticlePicked(object sender, ObiClothPicker.ParticlePickEventArgs e)
{
pickArgs = e;
}
void Picker_OnParticleDragged(object sender, ObiClothPicker.ParticlePickEventArgs e)
{
pickArgs = e;
}
void Update()
{
if (Input.GetMouseButton(0))
{
if (picker.durationsTouch <= 0.5f)
{
picker.durationsTouch += Time.deltaTime;
}
}
}
void Picker_OnParticleReleased(object sender, ObiClothPicker.ParticlePickEventArgs e)
{
picker.durationsTouch = 0;
Oni.SetParticleVelocities(picker.Cloth.Solver.OniSolver, new Vector4[] { new Vector4(0, 12, 0, 0) }, 1, picker.Cloth.particleIndices[e.particleIndex]);
pickArgs = null;
}
}
}
In the above, Unity throws 4 errors -
1. Assets\Obi\Scripts\Utils\ObiClothDragger.cs(47,21): error CS0117: 'Oni' does not contain a definition for 'GetParticlePositions'
2. Assets\Obi\Scripts\Utils\ObiClothDragger.cs(48,21): error CS0117: 'Oni' does not contain a definition for 'GetParticleVelocities'
3. Assets\Obi\Scripts\Utils\ObiClothDragger.cs(57,25): error CS0117: 'Oni' does not contain a definition for 'AddParticleExternalForce'
4. Assets\Obi\Scripts\Utils\ObiClothDragger.cs(88,17): error CS1501: No overload for method 'SetParticleVelocities' takes 4 arguments
As I am aware, in the new API you can directly access particle properties via the solver. As I am on the clock now, it would be great if I knew how to update these four lines, slightly confused with the new API help. If this script works the project has a green light ahead.
Again, sorry for the amateur question.
Any reason why the ObiClothPicker and ObiClothDragger classes were removed in the new version?
Also, getting a 64 - bit ARM version of the plugin would be great help Just in case things go haywire with the current hacky setup.
Posts: 6,326
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
(21-08-2019, 10:56 AM)arrnav96 Wrote: I was on version 3.5 then upgraded to 4.1.
I was recently able to update to 4.1 without losing actor states. How I did this was -
- Firstly closed the Unity project window.
- Backed up, then deleted old Obi folder. Also backed up "ObiClothPicker.cs" and "ObiClothDragger.cs" from old folder, which seemed to be missing from the new version folder.
- Copied and pasted the new Obi folder in the same project location.
- Copied and pasted the two cs files previously backed up.
- This was important, I copied all the .meta files from old Obi folder into the new one, placing them next to their respective files within Obi folder.
- As I was hoping, Unity remembered the states of all previous Obi scripts as it is and hence remembered their settings (Constraints, etc.) for every already initialized actors. Tested the actors and all worked like before.
- Built the game to device and it worked as now we had the 64 bit library as well!
The only issue left now (As the particle system API has changed vastly I presume), is that I am left with about 4 errors in the ObiClothDragger class. This is the script -
Code: using UnityEngine;
namespace Obi
{
[RequireComponent(typeof(ObiClothPicker))]
public class ObiClothDragger : MonoBehaviour
{
public float springStiffness = 50;
public float springDamping = 1;
private ObiClothPicker picker;
private ObiClothPicker.ParticlePickEventArgs pickArgs;
public float FingerDepthDurationFactor = 1.5f;
void OnEnable()
{
picker = GetComponent<ObiClothPicker>();
picker.OnParticlePicked += Picker_OnParticlePicked;
picker.OnParticleDragged += Picker_OnParticleDragged;
picker.OnParticleReleased += Picker_OnParticleReleased;
}
void OnDisable()
{
picker.OnParticlePicked -= Picker_OnParticlePicked;
picker.OnParticleDragged -= Picker_OnParticleDragged;
picker.OnParticleReleased -= Picker_OnParticleReleased;
}
void FixedUpdate()
{
if (pickArgs != null)
{
ObiSolver solver = picker.Cloth.Solver;
// Calculate picking position in solver space:
Vector3 targetPosition = pickArgs.worldPosition;
if (solver.simulateInLocalSpace)
targetPosition = solver.transform.InverseTransformPoint(targetPosition);
// Get particle position and velocity:
Vector4[] positions = new Vector4[1];
Vector4[] velocities = new Vector4[1];
int solverIndex = picker.Cloth.particleIndices[pickArgs.particleIndex];
Oni.GetParticlePositions(solver.OniSolver, positions, 1, solverIndex);
Oni.GetParticleVelocities(solver.OniSolver, velocities, 1, solverIndex);
// Calculate effective inverse mass:
float invMass = picker.Cloth.invMasses[pickArgs.particleIndex] * picker.Cloth.areaContribution[pickArgs.particleIndex];
if (invMass > 0)
{
// Calculate and apply spring force:
Vector4 force = (((new Vector4(targetPosition[0], -targetPosition[1], targetPosition[2], 0) - positions[0]) * springStiffness - velocities[0] * springDamping) / (invMass)) * (picker.durationsTouch / FingerDepthDurationFactor);
Oni.AddParticleExternalForce(picker.Cloth.Solver.OniSolver, ref force, new int[] { solverIndex }, 1);
}
}
}
void Picker_OnParticlePicked(object sender, ObiClothPicker.ParticlePickEventArgs e)
{
pickArgs = e;
}
void Picker_OnParticleDragged(object sender, ObiClothPicker.ParticlePickEventArgs e)
{
pickArgs = e;
}
void Update()
{
if (Input.GetMouseButton(0))
{
if (picker.durationsTouch <= 0.5f)
{
picker.durationsTouch += Time.deltaTime;
}
}
}
void Picker_OnParticleReleased(object sender, ObiClothPicker.ParticlePickEventArgs e)
{
picker.durationsTouch = 0;
Oni.SetParticleVelocities(picker.Cloth.Solver.OniSolver, new Vector4[] { new Vector4(0, 12, 0, 0) }, 1, picker.Cloth.particleIndices[e.particleIndex]);
pickArgs = null;
}
}
}
In the above, Unity throws 4 errors -
1. Assets\Obi\Scripts\Utils\ObiClothDragger.cs(47,21): error CS0117: 'Oni' does not contain a definition for 'GetParticlePositions'
2. Assets\Obi\Scripts\Utils\ObiClothDragger.cs(48,21): error CS0117: 'Oni' does not contain a definition for 'GetParticleVelocities'
3. Assets\Obi\Scripts\Utils\ObiClothDragger.cs(57,25): error CS0117: 'Oni' does not contain a definition for 'AddParticleExternalForce'
4. Assets\Obi\Scripts\Utils\ObiClothDragger.cs(88,17): error CS1501: No overload for method 'SetParticleVelocities' takes 4 arguments
As I am aware, in the new API you can directly access particle properties via the solver. As I am on the clock now, it would be great if I knew how to update these four lines, slightly confused with the new API help. If this script works the project has a green light ahead.
Again, sorry for the amateur question.
Any reason why the ObiClothPicker and ObiClothDragger classes were removed in the new version?
Also, getting a 64 - bit ARM version of the plugin would be great help Just in case things go haywire with the current hacky setup.
ObiClothPicker and ObiClothDragger were replaced with the more generic ObiParticlePicker and ObiParticleDragger. These work for any ObiActor, not just ObiCloth, and are much more performant. So you can safely delete ObiClothPicker.cs and ObiClothDragger.cs. In case you were using them, I suggest using the new versions instead.
Posts: 38
Threads: 8
Joined: Sep 2018
Reputation:
0
(21-08-2019, 11:16 AM)josemendez Wrote: ObiClothPicker and ObiClothDragger were replaced with the more generic ObiParticlePicker and ObiParticleDragger. These work for any ObiActor, not just ObiCloth, and are much more performant. So you can safely delete ObiClothPicker.cs and ObiClothDragger.cs. In case you were using them, I suggest using the new versions instead.
Can you kindly still provide the 64 bit version of the plugin? Seeing as our project has had multiple changes on both the previous Cloth scripts and adapting the new Particle scripts to the new project again would mean more time.
All we need is the 64 bit dll.
Posts: 6,326
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
(22-08-2019, 01:01 PM)arrnav96 Wrote: Can you kindly still provide the 64 bit version of the plugin? Seeing as our project has had multiple changes on both the previous Cloth scripts and adapting the new Particle scripts to the new project again would mean more time.
All we need is the 64 bit dll.
Hi there,
Write to our support email (support(at)virtualmethodstudio.com) and I'll send it to you.
kind regards,
Posts: 38
Threads: 8
Joined: Sep 2018
Reputation:
0
(22-08-2019, 04:02 PM)josemendez Wrote: Hi there,
Write to our support email (support(at)virtualmethodstudio.com) and I'll send it to you.
kind regards,
Sent, thanks.
|