How do I create a swing who's swing speed depends on the force with which you go in to it?

0 favourites
  • 3 posts
From the Asset Store
Awardkit
$5 USD
Create custom awards and achievement or use the many templates and create your own.
  • I am trying to figure out how can i make a grappling hook swing. At the moment im using a Sine attribute. This works fine when i make the magnitude = angle from where it was shot to the hook point, and the cycle position = 0.25, one fourth of the swing.

    But, when i make the magnitude dependent on the speed of the player (platform.VectorX), i should make the cycle position also dependent on the speed, but doesn’t work. The player is teleported to a random position of the cycle.

    To make the base of the grappling hook i have been following Marlins youtube tutorial series (https://www.youtube.com/watch?v=BqOtqEUnAVA&list=PLClYkAqkRMPwdlj5EIBvcE7Mb9ak0xuKm&ab_channel=Marlin).

    I can explain the issue further if anyone is willing to help.

  • While I'm not familiar with the tutorial you linked and I don't plan on spending hours watching it, I assume the swing speed of a sine based grapple would be based on the period, not the magnitude, which determines how far/wide the swing is.

    Granted if you've been using a constant period, then a larger magnitude will be faster as it has to cover more distance in the same amount of time. Anyways, wouldn't it make more sense to adjust the period based on your starting velocity instead? Then you wouldn't have to fiddle with the cycle start position either, which I'm guessing works fine if you follow the tutorial.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I had already set the period to be dependent on the platform.VectorX when the grappling is shot. The thing is that the period doesn't affect how far/big is the swing, it only affects how quickly a full cycle (4 x magnitude) is done.

    How I was trying to solve the problem by finding how much was the angle from the green to the red in relation to the total of the full cycle. And add that to the 0.25 (a 1/4 of the cycle). But I must not have implemented it correctly because it just doesn’t work.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)