Skip to content

Commit

Permalink
Update animated-entity-texture.md
Browse files Browse the repository at this point in the history
  • Loading branch information
QuazChick authored Jan 11, 2025
1 parent 0f03ea8 commit 65a140c
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions docs/visuals/animated-entity-texture.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
---
title: Entity Texture Animations
title: Entity Texture Animation
description: Learn how to make an animated texture for an entity that works similarly to flipbook texture for blocks.
category: Tutorials
mentions:
- MedicalJewel105
- IlkinQafarov
- TheItsNameless
- SmokeyStack
- QuazChick
tags:
- intermediate
category: Tutorials
description: Animate texture of your entity.
---

## Whats on this page?

From this page you will learn how to make an animated texture for an entity. Animated, like a flipbook texture for blocks.
From this page you will learn how to make an animated texture for an entity that works similarly to flipbook texture for blocks.

## Source

Expand All @@ -27,14 +26,17 @@ First let's draw some new texture frames for our entity. In this tutorial it wil

<WikiImage
src="/assets/images/visuals/animated-entity-texture/cow.png"
alt="cow"
width=180
alt="Frames of an animated cow texture stacked on top of each other"
width="180"
pixelated
/>

We need to place our textures vertically, like for blocks in flipbook textures.
In this case we have 4 frames.

## Materials
## Animated Material

### Creating the Material

We will need to modify materials in this guide. However due to render dragon materials became outdated, so **use it at your own risk**.

Expand All @@ -59,7 +61,7 @@ Or you can add this to existing ones, check default material file.
<CodeHeader></CodeHeader>

```json
"+defines":[
"+defines": [
"USE_UV_ANIM"
]
```
Expand All @@ -73,44 +75,44 @@ It is not that easy for every entity!
Some entities have multiple materials and if you want to make its texture animated, you will need to add this property to all materials of this entity.
:::

## Client Entity File
### Applying the Material

Before we go next, we need to define a new material in our client entity file.

<CodeHeader>RP/entity/cow.json#description</CodeHeader>
<CodeHeader>minecraft:client_entity > description</CodeHeader>

```json
"materials": {
"default": "custom_animated"
}
```

## Render Controllers
## Render Controller

After that all, we need to edit a render controller.

Here we will add `uv_anim` component with offset and scale properties:

<CodeHeader>RP/render_controllers/cow.render_controllers.json#controller.render.cow</CodeHeader>
<CodeHeader>RP/render_controllers/cow.render_controllers.json > controller.render.cow</CodeHeader>

```json
"uv_anim": {
"offset": [ 0.0, "math.mod(math.floor(q.life_time * frames_per_second),frame_count) / frame_count" ],
"scale": [ 1.0, "1 / frame_count" ]
"offset": [0, "math.mod(math.floor(q.life_time * frames_per_second), frame_count) / frame_count"],
"scale": [1, "1 / frame_count"]
}
```

Where `frames_per_second` is a count of frames you want to change in one second and `frame_count` is a total frame count.
…where `frames_per_second` is a count of frames you want to change in one second and `frame_count` is a total frame count.
This formula calculates the offset and the size of the texture depending on life time.

## Testing
## Result

Now, it is time to test your creation!

![](/assets/images/visuals/animated-entity-texture/result.gif)

## Download Example
## Download Example Pack

<Button link="https://github.com/Bedrock-OSS/wiki-addon/releases/download/download/animated_entity_texture.mcpack">
Download
Download MCPACK
</Button>

0 comments on commit 65a140c

Please sign in to comment.