mojira.dev
MCPE-230424

X and Z values in the "offset" array in projectile and behavior. fire_at_target components cannot be set relative to entity rotation, making them useless

Steps to reproduce

  1. Create a flat world with the attached addon applied.

  2. /summon dmss:cherry_dragon

  3. Spawn husks nearby the dragon.

Expected result

The dragon shoots from its mouth.

Observed result

The dragon shoots from a postion north of its body.

Cause

The game reads the array values in the “offset” parameter within both minecraft:projectile and minecraft:behavior.fire_at_target as relative world coordinates instead of as local coordinates (see https://minecraft.wiki/w/Coordinates#Commands ), and therefore it sets the offset relative to the shooter's position but not relative to its rotation. Moreover, the “offset” array does not accept molang expressions, so it is not possible to use molang to calculate a rotation-relative offset.


Hello,
I’ve been working on an addon with an entity that is dragon like (model that you can see in the picture) and can shoot at its target. Since behavior ranged attack will always shoot from the entities center I thout I would try the in 1.21.30 added fire at target (because it has an offset and I want it to fire from the mouth). I wasn’t sure what was happening at first since the logic of the offset seamed to work consistantly but I firgured out that the curretn rotation of the entity made a difference.

To make it simple: If it is for example looking north then the fireball is shot from the right place but if it isn’t looking north then it is shot from some other place in realtion to the entity. So is it a bug or intentional (and if it is intentional then how can I get the desired look?).
If needed I can try to also upload a video demonstrating it.

Also why can’t the ancor be a locator/bone in the entity model/why can’t I find documentation on what the owner_anchor numbers mean (I’ve been searching thru microsoft learn and wiki.bedrock.dev)
Kind regards

Attachments

Comments 5

We do not have enough information to reproduce this issue.

Please include the following information to help us understand your problem:

Steps to Reproduce:

  1. (Explain what needs to be done for the issue to happen)

Observed Results:
(Briefly describe what happens)

Expected Results:
(Briefly describe what should happen)

Please also attach any needed commands, add-ons/behavior packs, data packs, resource packs, screenshots, videos, or worlds needed to help reproduce this issue.

Refer to the Bug Tracker Guidelines for more information about how to write helpful bug reports. Bug reports with insufficient information may be closed as Incomplete.

This issue is being temporarily resolved as Awaiting Response. Once the requested information has been delivered, the report will be reopened automatically.
Quick Links:
📓 Bug Tracker Guidelines -- 💬 Community Support -- 📧 Mojang Support (Technical Issues) -- 📧 Microsoft Support (Account Issues) -- 📓 Project Summary -- ✍️ Feedback and Suggestions -- 📖 Game Wiki

Steps to reproduce:
1.)make a custom entity with fire at target and make it not shoot from the center
2.) make the entity fire at a target in different directions (like south, north, east, west)
Result:

The entity seams to not offset the projectile from its geometry but rater into for example north. Meaning the entity fire either from its mouth or above its back end.
Expected result:
for it to always fire from its mouth. (and why is there no good documentation for what the numbers on the anchor means?)
added visual:
spawn the cherry dragon. place a monster at least 6 blocks away and see its green projectile (might not be good for visibility in the video but thats all I can do…). Do that for all 4 direction (or more directions if needed) and make note of where the projectile spawns.

Now follows the addon, please note that it contains more material (work in progress) that isn’t needed for the problem and this is purely about fire at target (and the cherry dragon behavior has no errors in it)

[media]

I believe offset in both fire_at_target and in the projectile component (which can be used with ranged_attack, btw), is indeed relative to entity position but not to rotation. Have you tried using a molang expression for the x and z, like math.sin(query.body_y_rotation)?

Edit: nvm, molang expressions do not work inside the offset array.

As a workaround you could try having the projectile shoot from a dummy entity that summons at the dragon’s mouth.

I can try to get around with the dummy entity but how do I trigger that correctly with an entity that can shoot and bite?

Plus I keep asking myself why fire at target has an offset but not with the entities rotation….

I tried to implement a dummy entity but since I don’t want the entity to shoot on its own when mounted by a player it seams that in that case it doesn’t work (or a tleast I don’t have the knowledge to make it work…)

So please take a look at it (I understand that is might seam like a small error but I haven’t found a way to work around it)

Myro

(Unassigned)

1511052

Confirmed

Multiple

1.21.120

Retrieved