[BEHAVIOR] Sonic Physics

1 favourites
From the Asset Store
Hybrid Sonic Branding Kit is a business identity & motion graphics sound effects library.
  • PixelMonkey

    Thanks, I'm eagerly waiting. I'm working on art assets in the meantime, so it's not like my life depends on it The behavior is very useful though, and a very solid cornerstone of my game's mechanics. Without it I'd still be breaking my head open trying to figure out everything through events (which I actually did but does not work even half as good and painless).

  • Alright, small update to the behaviour. Again, so sorry about the wait. Had I known I'd be this busy I'd have waited until I could provide more regular updates.

    Changes:

    Air drag now works

    Simulate Jump now works again

    Can now specify an angle threshold for when the downhill slope factor will have an effect.

    Issue with 45 degree slopes locking controls fixed

    KZR:

    Found that slope issue you were talking about! When the object stops moving on a slope (assumed to be because it's too steep) the engine locks horizontal controls for a fraction of a second while the slope factor kicks in and pushes the player downhill a bit. Generally this is a good thing, since you don't want the player on a slope they can't walk up just pushing against it, but with slope factor disabled (which I'm assuming is what you did?) and when on a 45 degree slope (also assuming you did that) it triggers the lock, doesn't push the player down, and just sits there counting down the horizontal control lock and repeatedly triggering it again when it hits 0.

    The threshold for the angle is 45 (non-inclusive), but with swapping between radians and degrees being a little unexact it's counting 45.0000012522 as being above 45. Which it is. I've changed it so it's a parameter defaulting to 46: FallingAngleThreshold. If the slope is shallower than that, falling off should not trigger. Should fix the issue as it currently is, as well as allowing some fine-tuning if it still presents a problem.

    There are a couple obvious issues still present that I really need to work on (including tilemaps, which I will get to, I promise!), but if I'm honest I'd still expect things to be a little slow on my end for a bit longer yet. Please keep letting me know if there are any issues, and I'll try to solve them as soon as I can!

    Also, regarding rotation and the Set Angle property, I've had a quick go at it and ran into issues reliably moving things around so as not to clip a non-square bounding box into terrain or off a slope it should be sticking to. It isn't ideal, but as a workaround I'd recommend keeping the collision poly for the main object square, and overlapping another object with a non-square poly if you need one for other collisions.

    I'm getting to the point where my inexperience with some of this is showing, so if it comes to it, please bear with me as I try to refactor things to make future changes more feasible.

  • I've got my eye on this.

    Great work so far!

  • I'm either doing something wrong or reaching a point where I want the behavior to do more than it can. Either way, if I stop on a slope, regardless of angle, with slope up/downhill threshold activated, and even with high acceleration, I can't move. I updated the behavior to the latest version and left the minimum angles at 0.

    I think I'm not getting the right relation between friction, acceleration and slope factor. If it's not that, HELP!

    See for yourself in the CAPX:

    https://www.dropbox.com/s/xinz6s37qep4aqx/PhysicsYUNOWORK.capx?dl=0

  • KZR

    To clarify, the new Falling Angle Threshold property should be set to 46 to make this work (in the last version, this was hardcoded as 45, which was 1 degree off). With it at 0 I can see the issue, but setting it to 46 fixes it.

  • It works better now, thanks

    I'll keep you posted on any other stuff I may find

  • Just in case it may help you, I used to work with this engine, which is open source and recreates Sonic physics pretty well. If you can read C code, it might be of help. The code you're looking for is mostly in physics_actor.c.

    http://sourceforge.net/p/opensnc/code/H ... rge/trunk/

  • Ah cool, looks like a pretty solid implementation there. There are a few things I've done differently (mostly to mimic the Platform behaviour where it doesn't remove accuracy) but it could be good for reference. Thanks!

  • Trying to install but it says info.xml is missing from the root.

  • Tokinsom

    Ah, sorry, fixed. Really need to start double-checking things before I upload them.

  • How goes the plugin?

  • Effectively no progress since the last update, unfortunately, I have been busy with other things. I have a small break in a week or so, when I can hopefully sit down and work on this for a bit. I'll be sure to post any updates here when I have them.

  • hey it's been a while since the last update, how's it going?

  • This time round there has been a bit of progress. I'm not quite able to throw myself right into it, but my last exam for the semester is tomorrow, and after that I should have a lot more time to dedicate to things.

    I'm currently tackling the tilemaps, or more specifically tackling the way I retrieve angle so that it works with tilemaps. I'm also, by coincidence, making it work better with running off ramps. If you put a 45-degree-rotated square sprite down somewhere and try to run off it at speed, you'll notice there are issues.

    I don't quite want to put out a specific date, because as is evident, sometimes stuff happens and I can't stick to them, but I'd sort of like to have a new release and a template to go with it ready by SAGE, which'll be around the 11th of December.

    The behaviour itself will be updated here as soon as it's ready, though, of course.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Good luck, can't wait to see this finished.

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