Help Attaching a rope to a character controller... and somehow reading the force - 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 Attaching a rope to a character controller... and somehow reading the force (/thread-4072.html) |
Attaching a rope to a character controller... and somehow reading the force - Jambo - 10-12-2023 Hello, I've implemented my character using a character controller, because I prefer to have fine-grain control over it rather than use a Rigidbody. I would like to connect an obi rope to my character, so that she can pull an object connected to the other end. I've done this with a static attachement, which works great except that I would like to be able to read the force being applied (or rather ignored) at the static attachment so that I can manually affect my character controller's movement. Is there an easy way to do this? One option I've thought of, which feels like a hack, is to look at the position of the particle second-closest to the character, and use this to infer the tension in the rope and its direction, and use this to approximate the force. Alternatively, I could migrate to using a rigidbody instead of a character controller, which seems like a lot of effort. Any thoughts? RE: Attaching a rope to a character controller... and somehow reading the force - josemendez - 11-12-2023 (10-12-2023, 10:59 PM)Jambo Wrote: I would like to connect an obi rope to my character, so that she can pull an object connected to the other end. Hi! No, it's not possible to do this. Static attachments don't just "ignore" forces, they work by simply setting the position of the attached particle every frame, no dynamics of any kind are involved in this. Even if they calculated and then discarded forces, in order to somehow apply them they would need the object they're attached to to have physical properties -mass and inertia tensor at the very least- which a character controller doesn't. (10-12-2023, 10:59 PM)Jambo Wrote: I've implemented my character using a character controller, because I prefer to have fine-grain control over it rather than use a Rigidbody. Anything you can do with a character controller you can do using a rigidbody, they're just a regular object endowed with physical attributes. It is more complex to work with them but they're really the only option if you want your character to interact with other objects in any physical way since character controllers can't exert forces on other objects or be affected by them. Here's a good starting point for a physically-based character controller: https://www.youtube.com/watch?v=qdskE8PJy6Q (10-12-2023, 10:59 PM)Jambo Wrote: One option I've thought of, which feels like a hack, is to look at the position of the particle second-closest to the character, and use this to infer the tension in the rope and its direction, and use this to approximate the force. This would only work in very specific circumstances: force direction would often be wrong unless the rope has been completely taut for the past few frames, and you'd have to manually adjust the force magnitude to be in the ballpark of the actual force. As a side note, you can't really calculate stress force from strain (amount of deformation caused by the stress force) since strain depends not just on stress but on material properties and engine settings. kind regards RE: Attaching a rope to a character controller... and somehow reading the force - Jambo - 11-12-2023 Great, thanks for the advice. I'll switch to using a Rigidbody. I was able to get "okay" results using the distance between the first and 3rd particle; however, I can see that the benefits of using a Rigidbody extend much further than just this, so will switch. |