GameMaker-Bugs icon indicating copy to clipboard operation
GameMaker-Bugs copied to clipboard

Sprite Editor: Allow multiple custom origin points/hitboxes on a sprite

Open iampremo opened this issue 2 years ago • 10 comments

Description

Basically what I'm thinking is just the ability to add as many origins to a sprite as you want. The first origin or maybe just a specified origin would be designated as the actual origin of a sprite as we know today where it can rotate, scale, move, spawn, etc around that point. Though you would have the ability to drag in multiple origins that don't necessarily do anything by themselves, but you can reference them in code and it will fetch their position, and hopefully it'd just be a simple x and y fetch and the x and y would obviously follow the sprite and object perfectly as origins do now, which is also complicated to do manually as you have to calculate rotation and scaling and all sorts of stuff.

For example, you have a gun that is attached to the player from the 1st origin that's placed on the butt stock, though you could add an origin on the end of the barrel of the gun and use instance_create_depth(Origin[1].x or sprite_origin_get_x(spr_Gun,"Barrel"), etc., 0, obj_Bullet) and it would spawn a bullet at the designated barrel origin.

In animation, the origins could just possibly carry on for each frame, but you would have the ability to have custom origins for each frame as well? Though that might be an entirely different function or feature, but it'd be nice to see custom origins for each frame as well.

Personally it would be amazing to have points on guns designated for attachments like scopes on top of the gun or points where the bullet leave or points where the hands grab, and currently that is a lot of manual work or work making tools to actually get these points. There's also just a lot more possibilities, like making enemy spawn points on a sprite that'd be the map, making hitbox points or rectangles by connecting 4 origins.

Benefit:

This change would be simple but streamline the process of making particle points, attachment points, rotation points, spawn points, etc, extremely easily without losing any versatility or complexity.

iampremo avatar Jun 06 '23 14:06 iampremo

Yes!!! I've requested something like this in the past too - It'd be cool if we could also add multiple bounding boxes as well, because in my games the collision hitbox and the "which parts I want to apply damage" boxes are different almost always

WangleLine avatar Jun 13 '23 11:06 WangleLine

The multiple bounding boxes would be a huge time saver for me, along with the multiple anchor points!

adamrpippin avatar Jun 13 '23 15:06 adamrpippin

Another nice addition would be if you could optionally set a direction value for each point, which would be useful for things like spawning projectiles at the tip of a weapon that isn't pointing straight forward

KormexGit avatar Jun 19 '23 02:06 KormexGit

YES! This would help making things like hats, shooting from specific points of weapons, making easier bone animations and better hitboxes. Seems like a lot for the ide, but it would help me a lot. =)

ThomazDiniz avatar Dec 07 '23 22:12 ThomazDiniz

This would be a huge time-saver to have! I am currently trying to figure out how to place an object based on its 0,0 origin while rotating it around its center. Having multiple origin points would make this trivial. Without this feature, it requires some math that I, unfortunately, don't quite understand.

Talkashie avatar Apr 06 '24 21:04 Talkashie

It's a little disheartening to see every suggestion for additional collision masks closed and redirected to this, as I feel like the comments here don't go into a lot of detail on the issue, and they're solutions to very different problems. In my experience, most use cases for multiple origin points can be solved pretty easily with code, whereas hitbox/hurtbox implementation is always either obscenely tedious or incredibly slow.

Just wanted to throw in my two cents that only allowing for one collision mask per sprite is by far one of GameMaker's biggest weaknesses right now. As my projects get more complicated or I want to delve into certain genres like beat-em-ups, implementing custom hitboxes and hurtboxes is an annoyance that never seems to get less frustrating to deal with.

My idea for implementation is similar to the way Animation Curve assets can hold multiple curves. Sprites should be forced to have a single collision mask by default so as to not complicate the basic collision functions, but they should allow for additional masks to be created. New functions could be introduced for checking collisions using these additional masks, or the existing collision functions could take two more optional arguments. (Which mask to use in the calling instance, and which mask to check for collisions with in the colliding instance.)

Really hoping to see development on this front.

BrittleLizard avatar Aug 31 '24 23:08 BrittleLizard

All of this sounds a bit similar to my animation editor I've made a long time ago https://web.archive.org/web/20160107164542/http://gmc.yoyogames.com/index.php?showtopic=664239 Could have custom data attached to animations: points, hitboxes, sounds, text, scripts It was for GMS1 though. Not many people used it, so I've only supported it for my own usage. I got a version that works with GMS2, but never released it. That thing was written in Pascal, and I don't want to work with Pascal anymore, so it's still a bit buggy. I'm waiting for IDE plugins to see if I can rewrite it with C# as a part of IDE.

Gamer-XP avatar Oct 01 '24 06:10 Gamer-XP

I'd love to have that feature built-in.

@Gamer-XP Oh, if your GMS2 version still work, would you mind sharing it somewhere ?

Manukineko avatar Mar 22 '25 09:03 Manukineko

I'd love to have that feature built-in.

@Gamer-XP Oh, if your GMS2 version still work, would you mind sharing it somewhere ?

Don't want to bother with making a proper release of it for now. Write me in discord "GamerXP", I can send you files directly.

Gamer-XP avatar Mar 22 '25 09:03 Gamer-XP

When adding support for multiple origin points per sprite (or object) it would be great if you can decide which origin to use for the level editors grid snapping and object coordinate and independently from it which one to use for rotating and mirroring. Sometimes you want to use top-left for grid snapping, center-bottom for depth-sorting and center-middle for rotating and scaling.

Having points for bullet spawns or attaching limbs and character skins is the other big benefit of it.

TrunXGIT avatar May 11 '25 15:05 TrunXGIT