28-09-2022, 12:33 PM
(This post was last modified: 28-09-2022, 12:38 PM by josemendez.)
(28-09-2022, 09:16 AM)lacasrac Wrote: This is the order:
0, I have 2 controlpoints and a rope blueprint by defaultĀ
1, raycast from the origin to the player
2, increase the rope length until reach the player with ChangeLength + update their positions, set invMass 0
3, AddNewControlPoint on the player's leg transform
4, pull up the player with the rope: invMass set Back to 10, and changeLength decrease
5, after 2 seconds I need to detach the last control point, so remove that last control point (DeleteLastControlpoint)
What is the good ordering on this? Is it possible to detach the rope after attached to something?
I don't see why you would need to add or remove control points at runtime, I think you're misunderstanding the core concept of blueprints. Their only purpose is to specify the initial shape of the rope and particle placement/count at the start, that's it. Once the rope is created and the simulation starts, the blueprint (and the control points) basically stop being used, you're only concerned about particles then. If you wish to add or remove attachments, you can just create/destroy new ObiParticleAttachment components. If you wish to change the length of the rope, you use a cursor.
You don't need to create or destroy control points to create attachments, control points have nothing to do with attachments whatsoever. An attachment is a component that takes a particle group and attaches it to an object. You can simply destroy the attachment to remove it (or even just disable it), you don't need to add or destroy control points in the blueprint.
Note that attachments take a particle group as input, not a control point. Even though the blueprint will create a particle group for each control point for convenience, you can create your own particle groups at runtime since they're just a scriptable object.