Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug / Crash  Issue with Grasping ObiRope Using Two ToolsGood morning, I’m encountering a strange
#4
Hi Alice,

The following code is unnecessary, and may lead to incorrect behavior as it resets the state of the rope every time you attach a particle:
Code:
actor.solver.RemoveActor(actor); // Refresh the actor in the solver
actor.solver.AddActor(actor);
Debug.Log("Actor re-added to solver.");

What this does is take out all particles and constraints from the solver and reorder all other actor's data (which is expensive), then re-add the actor using the data stored in the blueprint. Adding attachments at runtime does not require doing this.

Additionally you're adding new particle groups to the blueprint:
Code:
actor.blueprint.AppendNewParticleGroup("GraspedParticles");

but never deleting them. This might not be a problem but over time can add up to a significant amount of scriptable objects being created.

Also keep in mind that having multiple attachments on the same particle will yield undefined behavior as warned in the manual. Your code does not check whether the particle about to be attached is already attached, so in case both left and right hands grasp the same particle you'll be in trouble:

Quote:Particles affected by more than one attachment will follow the attachment that was updated last. The update order for attachment is undefined.

kind regards,
Reply


Messages In This Thread
RE: Issue with Grasping ObiRope Using Two ToolsGood morning, I’m encountering a strange - by josemendez - 10-12-2024, 11:47 AM