Help How to generate rope from one point to next points ? - Printable Version +- Obi Official Forum (https://obi.virtualmethodstudio.com/forum) +-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html) +--- Forum: Obi Rope (https://obi.virtualmethodstudio.com/forum/forum-4.html) +--- Thread: Help How to generate rope from one point to next points ? (/thread-3098.html) |
How to generate rope from one point to next points ? - webmagic - 15-09-2021 Hi , let’s say we have 3 point in the scene (attached), how to generate rope from point 1 to point 2, and continue from point 2 to point 3? In runtime. For example, there are some balls in the scene, when I press the button, a rope generated through these three points by order(like: 1~2~3~4~5….) RE: How to generate rope from one point to next points ? - josemendez - 16-09-2021 (15-09-2021, 10:29 PM)webmagic Wrote: Hi , let’s say we have 3 point in the scene (attached), how to generate rope from point 1 to point 2, and continue from point 2 to point 3? In runtime. Hi there, See: http://obi.virtualmethodstudio.com/manual/6.2/scriptingactors.html Basically you create a new blueprint, and add one control point for each point you want the rope to pass trough. Here's a script that fully sets up a rope between two points and attaches it to them completely from scratch. Adding more points is trivial (just add more calls to AddControlPoint). Note the rope position and rotation is calculated from two points, so you might want to adjust it depending on your needs. Code: using UnityEngine; RE: How to generate rope from one point to next points ? - webmagic - 16-09-2021 Thank you RE: How to generate rope from one point to next points ? - Churger - 23-09-2021 josemendez Is there a way for the rope that your script generates to have a material. I have been trying to generate a rope between two transforms during runtime preferably with a prefab but I haven't had any luck. RE: How to generate rope from one point to next points ? - josemendez - 24-09-2021 (23-09-2021, 10:35 PM)Churger Wrote: josemendez Is there a way for the rope that your script generates to have a material. I have been trying to generate a rope between two transforms during runtime preferably with a prefab but I haven't had any luck. Hi, Of course. The rope is just an object like any other, so you do this the same way you do for any object in Unity: access the renderer and set the material. Code: rope.GetComponent<MeshRenderer>().material = <your material> RE: How to generate rope from one point to next points ? - Churger - 25-09-2021 Thanks for the solution!, however all I can get to show is this thin line? Sry if the image does not show I am new to this. RE: How to generate rope from one point to next points ? - Churger - 25-09-2021 Never mind I found the solution, I forgot to put the script on the solver, thank you so much for the help. |