Animate ropeImposter hook position?

Hello. Is the title possible? I’ve been playing around with a toy rope climbing game using the anno.js plugin. I have an cube that’s controllable and plenty of lineMeshes(ropeImposters) the cube can attach to (.addHook()), but is there was way to move the cube up and down the rope?

@Cedric or @RaananW may be able to help.

Yes, you can do something.
Check this PR I did:
A static body is attached to the rope, and you can move that body.
You can’t move the rope endpoint directly but you can move what’s attached to.
https://playground.babylonjs.com/#8WC6ZN#185

1 Like

Thanks. Yes, that’s very similar to the setup I currently have - unfortunately doesn’t solve my use case. I guess since you can’t moved the endpoint directly, you also cant change the length of the imposter after initialization?

Thanks for your help guys.

Do you mean visually (the rope) or physically (the imposter)?
Obviously, the rope will not magically become smaller because you move your sphere or cube that is defined as an endpoint, so this part seems logical to me.
Now, funny enough, I did some tests with’ the rope’ to use as an imposter (without the visual rope representation), precisely because of the faen properties you can change dynamically(i.e. when using hooks). I guess here the problem must be essentially that your cube as you say should be moving ‘along’ the rope, so it cannot be the endpoint of the rope. (at least of the visual representation of the ‘rope’), yes?

Edit: Ok, just very quickly done (hope it will not hurt your devs feelings;) but just to illustrate in 2min
https://playground.babylonjs.com/#8WC6ZN#186

The endpoint does not move, the sphere moves but then (of course) there is no hole in it, so it just moves (levitates;) ‘along’ the (visual representation of) the rope…
Edit2: sry, this is really just very sketchy to understand if your object is attached or moves along the rope? I will try clean this later if necessary. Right now I have a sunday family BBQ to attend to;) sry… hope this can at least help to the overall understanding of your needs…

Thanks for your time Mawa, i don’t think im explaining myself very well.

I guess both?

I’d like to figure out a way for the user to move the cube up and down the rope (and imposter).

Heres a playground, I had to change some stuff to make it work. I couldnt figure how to get the height and width of the playgrounds canvas, so you’ll need to close the editor window for the mouse to work properly. Right click to fire a rope, A, D to swing. (The goal is to have W, S to move the cube up and down the rope).

https://playground.babylonjs.com/#7H3JUP#2

1 Like

Ok, sry, I didn’t see any rope in your PG but from the above I sort of understand that I did not completely understand your topic;) Is it like a grappling hook. Your character fires a grappling hook (with a rope, and this is the rope you are talking about, correct? Like i.e. FarCry. LoL, not at all what I had imagined. If so, I guess you need to attach the endpoint of your grappling hook and rope to (an existing) hook/target, correct? Now, what was the issue again, if the above assumption is correct?

Edit: Oopsie, correction, I can see the rope firing (right-click, is it;) I believe with this PG @Cedric should be able to help you out (hopefully). This one flies too high for me, sry, I’m afraid of heights;)
Nice PG, btw…
One thing that strikes me though is that your character is hooked to the endpoint of the rope. He next would need to move along the rope (as an intermediate hook) and the endpoint should be the result of physics from where it has been ‘released’ from the mass of your character? So at some point (when initiating the vertical move, likely) the character should move along this ‘dynamic’ hook set on the rope (and not the endpoint)…very interesting… I will follow and shall hope you will soon get your answer from the big brains here;)

1 Like