Skip to content

Conversation

SnekProgrammer
Copy link

Added animations for mining / breaking blocks, scales with the tool's swing speed.

Could also have animations be data driven in the asset files.

Screencast_20251007_205040.online-video-cutter.com.mp4

PS: new to both Cubyz & Zig, so this may not be implemented in the best way / place.

@codemob-dev
Copy link
Contributor

I made a PR almost exactly like this a while ago, we decided against it in favor of having data-based animations.

@SnekProgrammer
Copy link
Author

I made a PR almost exactly like this a while ago, we decided against it in favor of having data-based animations.

I can probably add that as a feature, maybe with

.swing_animation = .{
     .pos = .{x, y, z},
    .rot = .{x, y, z},
    .speed_multiplier = x,
}

example pickaxe.zig.zon

.{
	.blockTags = .{.mineable},
	.disabled = .{
		0, 0, 0, 0, 1,
		0, 0, 0, 1, 1,
		0, 0, 0, 1, 1,
		0, 1, 1, 0, 1,
		1, 1, 1, 1, 0,
	},
	.optional = .{
		1, 1, 1, 1, 0,
		1, 1, 1, 0, 0,
		1, 1, 1, 0, 0,
		0, 0, 0, 1, 0,
		0, 0, 0, 0, 0,
	},
	.parameters = .{
		.{
			.source = .massDamage,
			.destination = .damage,
			.matrix = .{
				2.5, 2.0, 1.5, 1.0, 0x0,
				2.0, 1.5, 1.0, 0x0, 0x0,
				1.5, 1.0, 0.5, 0x0, 0x0,
				1.0, 0x0, 0x0, 0.1, 0x0,
				0x0, 0x0, 0x0, 0x0, 0.1,
			},
			.factor = 1.0,
			.method = .average,
		},
		.{
			.source = .hardnessDamage,
			.destination = .damage,
			.matrix = .{
				0.0, 0.0, 0.1, 0.1, 0x0,
				0.0, 0.1, 0.0, 0x0, 0x0,
				0.1, 0.0, 0.0, 0x0, 0x0,
				1.0, 0x0, 0x0, 0.0, 0x0,
				0x0, 0x0, 0x0, 0x0, 0.0,
			},
			.factor = 1.0,
			.method = .average,
		},
		.{
			.source = .durability,
			.destination = .maxDurability,
			.matrix = .{
				0.5, 1.0, 1.0, 1.0, 0x0,
				1.0, 2.0, 1.5, 0x0, 0x0,
				1.0, 1.5, 1.5, 0x0, 0x0,
				1.0, 0x0, 0x0, 1.0, 0x0,
				0x0, 0x0, 0x0, 0x0, 0.5,
			},
			.factor = 1.0,
			.method = .average,
		},
		.{
			.source = .swingSpeed,
			.destination = .swingSpeed,
			.matrix = .{
				0.1, 0.5, 2.0, 2.5, 0x0,
				0.5, 1.5, 0.5, 0x0, 0x0,
				2.0, 0.5, 0.1, 0x0, 0x0,
				2.5, 0x0, 0x0, 0.1, 0x0,
				0x0, 0x0, 0x0, 0x0, 0.1,
			},
			.factor = 1.0,
			.method = .average,
		},
	},
	.swing_animation = .{
		.pos = .{-0.1, 0.0, 0.2},
		.rot = .{-0.2, -0.1, 0.0},
		.speed_multiplier = 1,
	}
}

Keyframed animations are also likely possible, but I feel that might be overcomplicated for a simple animation.

Copy link
Member

@IntegratedQuantum IntegratedQuantum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check out past discussion on this #726 #1677 and adapt your PR accordingly.

@SnekProgrammer SnekProgrammer marked this pull request as draft October 8, 2025 17:53
@ikabod-kee
Copy link
Collaborator

I feel that we should get rid of Undertime mining before continuing, as it's been proven to look awkward and will be replaced with a better system in the future anyhow.

@IntegratedQuantum
Copy link
Member

I feel that we should get rid of Undertime mining before continuing, as it's been proven to look awkward and will be replaced with a better system in the future anyhow.

Do you mean we should go completely away from damage per swing or what?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants