Circular movement around player?

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • I am trying to do something that I have a sense should be quite straightforward if one knows how to do it. What I am after is essentially that there is the main character and then there is a "ball" that is at the center of the character, but as you move the controller stick the ball moves out from the player in the direction you move the stick. If using a controller the ball should also just move out a bit if tilting the stick a bit and fully to its max range which is the max range of the circle when you pull the stick more (up to a point). I made a picture also to demonstrate what I mean.

    Do anyone know how to achieve this?

    Please login to see this attachment.

    Steam games: Please login to see this link.

  • the ball needs an angle; just use ALT A as this.

    always :

    position X(ball) to man(X)+cos(ALTA/angle(ball))* (distances away from man)

    position Y(ball) to man(Y)+sin(ALTA/angle(ball))* (distances away from man)

    add (speed of rotation) to ALTA/angle(ball)


    so the math looks like this;

    x=x+cos(angle)*radius

    y=y+sin(angle)*radius

    *adding to the angle - or subtracting from the angle with make it rotate anti clockwise or clockwise respectively. * the amount you add or subtract will affect the speed of the rotation, eg; 1=slow, 10=fast

    you dont need to but you could add (just to keep the angle inside the 360 degrees):

    ALTA/angle(ball) = ALTA/angle(ball) Mod 360


    the distance away from the man is dictated by the radius/distance. adjust this value will push it in or out from the man.

  • As danjo said before, but here are 2 examples I made before:

    Zoom and rotate scenes (custom method, meaning no shaders or extension used)
    Can be used to rotate stuff around a point, like planets orbiting around the sun

    Features:

    • Zoom relative to a point
    • Rotate around a point
    • Customizable Center
    • Bonus Example included, behaves more like a widget
    • Should work on all runtimes
    Code
    Controls:
    - Right Arrow: Rotate to the right
    - Left Arrow: Rotate to the left
    - Drag the crosshair like object to change the center

    Files:

    • Please login to see this attachment.
    • Please login to see this attachment.

    Game/App developer, artist and a community contributor.
    You can support my work on: Please login to see this link.

  • Nice thank you! I manage to do an example and attached it, but did I misunderstand something regarding the cos(angle)? I just set it to 0 and I did not see any difference adjusting it to another value besides 0?

    Also I wonder is there some technique I could use to make the ball move even smoother between points? In the example I am using the controllers analog stick to adjust the balls position but the position changes of the ball can "jump" a bit in an jarring and uneven way even when trying to control the stick very slowly and controlled. Is this possible to adjust somehow to make the ball always move in a smooth transition between one point to another?

  • After trying some more I assume the "jump" in the ball is because of the deadzone in the controller? But how to get a smooth circular movement for the angle in all positions without this jump? Imagine the circle is the aiming of the weapon in a game then it should not "jump" like that when moving it slightly at the left,up,right,down positions?


    Please login to see this attachment.

    Steam games: Please login to see this link.

  • It's probably related to stick deadzone yeah

    In general, you seem you want to interpolate, for angles the interpolation can be a bit more complex compared other scenarios, but it's generally:

    Code
    ((((Pos_Current - Pos_Target) mod 360) + 540) mod 360) - 180

    I made an example for this before (the interpolation, in terms of the roation around a point I already posted the examples above, and you already implemented that anyways)

    MFA: Please login to see this attachment.

    Game/App developer, artist and a community contributor.
    You can support my work on: Please login to see this link.

  • It's probably related to stick deadzone yeah

    In general, you seem you want to interpolate, for angles the interpolation can be a bit more complex compared other scenarios, but it's generally:

    Code
    ((((Pos_Current - Pos_Target) mod 360) + 540) mod 360) - 180

    I made an example for this before (the interpolation, in terms of the roation around a point I already posted the examples above, and you already implemented that anyways)

    MFA: Please login to see this attachment.

    Thank you that is an really awesome example!

    About the deadzone though it must be something wrong since pretty much 90% of games that use analog stick (like twin stick shooters etc) dont get this jump when steering the aim of the character? Something is clearly wrong in my example?

    Steam games: Please login to see this link.

  • Just the first random game I fired up where there is an exactly the same mechanic of steering the crosshair with the analog stick and there is zero issue like inmy example with this even though same controller and same deadzone so something is wrong?

    Please login to see this attachment.

  • Just tried this with both an old Logitech F310 wired controller (which has a very big built-in deadzone in other apps) and a newer 8bit SN30 pro (which doesn't have the deadzone in other apps) but both of them had the same issue with the example MFA. I *think* it might be an issue with the Xbox Gamepad object in fusion - an alternative is Please login to see this link..

  • Just tried this with both an old Logitech F310 wired controller (which has a very big built-in deadzone in other apps) and a newer 8bit SN30 pro (which doesn't have the deadzone in other apps) but both of them had the same issue with the example MFA. I *think* it might be an issue with the Xbox Gamepad object in fusion - an alternative is Please login to see this link..

    Yes I only have the issue also in the example MFA and the controller of the aiming in a twin stick shooter needs to be precise with the analog stick and can't have that jump or jank since it does not allow you to aim properly. This is my first time developing a game in Fusion with the primary analog controller in mind (Twin stick shooter) but it must be a way to get it to behave in other games as it should with precise aiming? Having this jank is not an option as it would play horribly and look extremely amateurish. I am still extremely early in this new project but I need to find a way to do this or I would have to consider changing to another game engine. I have been using and shipping games with Fusion since Click and Play days and it has done everything I need when it comes to 2D (except zoom) so having to abandon it because of not being able to control the analog sticks properly with a controller in a game would be a real shame :/. I looked at the SDL object and when I check the example MFA it does seem to be detecting the exact spot of the analog sticks (I think) though the numbers are huge so I don't know how to implement it properly to see if it is possible to make it work with a smooth aiming with the stick instead of this where it skips the angles and jumps. I will try some more but perhaps someone else could take a look at it or have used it before? Maybe the formula is just wrong somehow in my mfa example and it needs to be done another way? I mean someone else must have came across this before when developing a game with a game controller in mind? It seems like such a critical thing that it should have been addressed before?

    Again I checked some more games and have uploaded how it should look properly vs how it looks in the example and also with just a line instead of the ball.


    Please login to see this attachment.Please login to see this attachment.Please login to see this attachment.Please login to see this attachment.Please login to see this attachment.

    Steam games: Please login to see this link.

  • I have uploaded the new example using the SDL Object. One thing I did notice is that you need the gamecontrollerdb.txt in the game folder for it to work. I don't think this is a problem for the final game (?) or is this just something in the current state of this extension and will it be baked in at a later point?

    Looks so much better now :)

    Please login to see this attachment.

  • Nice work!

    Not sure why the XBox gamepad object has the weird deadzone settings - prior to the object being added, the other option was the Joystick2 object, which doesn't have the deadzone issue but is older and has other issues that might make it a little tricky for modern gamepads (such as R2/L2 sharing a single axis)

    The SDL object is much easier IMO and the button layout should be the same between each individual gamepad. You shouldn't need to include gamecontrollerdb.txt with the game - that's only required because you're loading gamecontrollerdb.txt in the events. If you delete this action, it will work fine. It's mostly just there for custom or rare controllers that need special mapping.

  • I tried the Joystick2 object also but it produced the same janky behavior. At least in the way I retrieved the numbers from the sticks, perhaps it is possible by retrieving them some other way? Again I am not sure if it is actually possible to get a smooth proper behavior with the Xbox gamepad object also in some other way (someone might know?)

    If not it seems like this SDL object should really be the new standard object for controllers :) Thank you for letting me know about it!

    Steam games: Please login to see this link.

  • you will have the old one. the new one is called [SDL OBJECT] in your extensions, old is just SDL - the old still does everything tho.

    the new one is beta from Phi. - its a bit different to use than SDL (eg has different methods of detections etc), but has some better features, and is compatible with nearly everything.

    i (think) the beta one is for his patreons ( so throw Phi some money ) and he will sent it to you.

  • PKR's SDL Joystick is based off of SDL2, is open source and free. The latest version of this extension is from a month ago

    Phi's SDL Object uses SDL3. I believe it was originally open source (I think it might have been a fork of PKR's but not sure),now closed-source and paid(?). I think it's also ported (or in the process of being ported) to other runtimes. Please login to see this link. for both extensions (confusingly)

    IIRC Clickteam have mentioned working on a new object of their own for more modern controller support, but I don't remember where it was posted (probably one of the release/update threads)

  • While I do respect Pkr for making the og SDL joystic and the fact that it's open source, Phi's paid version is just WAY better, but again kudos for PKR

    I have it as I was a member of phi's Patreon for a couple of months before banks in my country started restricting international payments using debit cards

    It's cross platform (5$ or 10$ per runtime if I remember correctly in the case of a separate purchase) way more features, like more useful properties, actions, conditions and expressions, better documentation (also things like gamepad support so it's not raw only, unlike the og object that made it way harder to support different controllers and having to manually change behaviors based on the controller as each controller has different raw data, gamepad tries to combine it all into one universal package which is not a thing in PKR version, or at least not working as expected there)

    Game/App developer, artist and a community contributor.
    You can support my work on: Please login to see this link.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!