[Need a hand!] - Swinging like Spider-Man

Ah, it’s true that the cable itself doesn’t auto-break when the player is above vertical… BUT you’ll notice that the web cable also stretches as it approaches horizontal. The idea is to prevent situations where the player’s swinging momentum can start to shove him backward. Their solution is actually quite clever (making the cable get longer the further Spidey is from the fulcrum point) but the net result is the same; it should not be possible to swing in a full loop PERIOD, even if that’s what you’re trying to do.

[=RhythmScript;229168]
Ah, it’s true that the cable itself doesn’t auto-break when the player is above vertical… BUT you’ll notice that the web cable also stretches as it approaches horizontal. The idea is to prevent situations where the player’s swinging momentum can start to shove him backward. Their solution is actually quite clever (making the cable get longer the further Spidey is from the fulcrum point) but the net result is the same; it should not be possible to swing in a full loop PERIOD, even if that’s what you’re trying to do.
[/]

This brings up two things in my mind: Spider-man games do everything differently, JUST to be confusing. I just booted up Spider-Man 3 and Amazing Spider-Man 2 and both let you spin around in a loop if you’re not careful, Whereas Spider-Man 2 / Web of Shadows doesn’t seem to let you.

Secondly, I think this is where Blueprints reach their limit; I’ve scowered the documentation, Every answerhub question about it and all the forum posts remotely about it; There seems to be no way to dynamically set the distance between two physics handle objects (Change the size of the physics handle dynamically).

There might be a way but I’ve literally spent hours trying to figure it out and I haven’t gotten anywhere; And it’s not really a deal-breaker; Worst comes to the worst, I can delete the old psychics handle and replace it when the player is horizontal, or just start pushing them back or whatever. No biggie.

Wait… If you’re using a Physics Constraint, you can’t Set the Constraint Linear Limit in BP? I thought for sure you could…

[=RhythmScript;229332]
Wait… If you’re using a Physics Constraint, you can’t Set the Constraint Linear Limit in BP? I thought for sure you could…
[/]

I totally didn’t notice that before as I was creating the Constraint manually. However, that won’t let me alter the length of the cable… Or am I missing something?

You should detach from the previous handle whenever the dot product is below zero.
(IF you are HIGHER than the handle’s position when attaching, only AFTER the dot product first turns to > 0 you then detach; or else you gonna detach as soon as you attach to it I guess).
Whenever this graph prints that green string, you should detach from the handle. it means the body is at speed and is higher than the handle’s position in world and you should let it go:

Here’s a very cool post explaining a little about what ‘dot product’ does. You can use this stuff for soooooooo(oooo++) many things, it’s soo cool:
http://www.wildbunny.co.uk/blog/vector-maths-a-primer-for-games-programmers/vector/#Dot

[= ;228316]
There is a new movement component called “rotating movement” component, maybe give that a try? I’m immensely interested in seeing where this goes as I want to update my to allow swinging movement as well as the standard direct-pull that it currently does.
[/]

would this work in a 2d game by any chance?

Any updates, Kitatus?

I’d like to be able to implement this mechanic in a forest/nature/Avatar-y type game world. Inspired by your progress so far!

Okay sounds good, best of luck on your other projects!

Hey dude, working on a similar feature ^^ was just wondering if i could get the unfinished project and have a look :)?

Thank you very much :slight_smile:

Hey man, is it possible you could send me your blueprints for the swing mechanic when you have the time? Working on a swing mechanic myself… Thanks

I belive he is working on it :slight_smile: but i can kinda understand if he didint want to release it ^^

This is great!

Very interested in trying to get this working. The 4.2 version of swinging is just blown to heck.

Sorry to bump, any headway with this?

I’m working on the exact same project LOL looking through the same research material including conversing with the spider-man 2 guy. I’m glad to know someone else started this before me so I can get the bugs in mind before hand.

Howdy, I stumbled upon this thread a couple days ago while working on my own grapple/swing mechanic. I went through many of the same steps before moving a different direction. I’ve got something that works fairly well I think (for a prototype at least). Still lots of improvements and some bugs to work out (most notably, there are gimbal lock issues when adjusting your momentum while swinging).

Here are the basics:

  • Fire grapple out where it can latch onto a surface.
  • You can pull yourself to the latch point.
  • You can swing from the latch point if you jump or fall off an edge (assuming you have room to swing).
  • If you come in contact with the ground while swinging you will unlatch.

It’s still early so there may be some pitfalls. But if nothing else I think my technique could help you figure out if your grapple game concept is interesting enough to pursue further.

Technical basics of grapple mechanic:

  • Ray trace to find latch point.
  • When swinging commences compute idealized pendulum movement and move player to “follow” this pendulum. This has the added benefit of preserving collisions for the player so you can deal with them as needed (stop swinging if you bump into something)
  • Add buttons to lengthen or shorten the grapple cable or change the angle of swing. Simply updates the values in the equations used to compute the position of the idealized pendulum your player is following. NOTE: I haven’t solved some gimbal lock issues with this yet.
  • You can pull yourself towards the grapple point which just pauses the pendulum swinging and moves you quickly towards the latch point.

There is a decent bit of 3D math involved to accomplish all of this. But it’s not overwhelming. I’ve done all of this with blueprints though it’s probably debatable whether or not I should have done more in C++. The math in particular is way less messy in C++.

If you’re interested in the project I could probably pack up the files or something. I’ll check in on the thread every now and again just in case. And you can always PM me.

Anyone who came up with a solution?

I’ve added mechanic. Feel free to push forward project. https://www…com/watch?v=VAEvSd-m9LE&feature=youtu.be