#Head not looking at player

1 messages · Page 1 of 1 (latest)

midnight saffron
#

Head looking at player

#

I want a 10 block radius of detection

#

Head not looking at player

dense monolith
#

Have you labeled the head in its own group in blockbench

#

It's how minecraft can tell where the head is.

midnight saffron
#

I think it's like this

dense monolith
#

Yeah that's it, if you want I can send over my code and you can compare them

#

Oh and you might want to change priority to 1.

midnight saffron
#

Ok

dense monolith
#

Well? It working?

crude oasis
#

Hi guys that's my problem to can I have also the code thank you

midnight saffron
midnight saffron
crude oasis
#

Ok

#

Even you set the priority to 1

#

?

midnight saffron
#

yes

crude oasis
#

Do you have locator?

midnight saffron
#

I don't know that

crude oasis
#

Here I send you

#

Maybe you a locator

#

I will also try your coding

midnight saffron
#

I can test now

#

Locator is in RP/entity ?

shell moon
#

Locator doesn't matter

midnight saffron
#

oh

shell moon
#

It's just animation that it, locator just add particle

midnight saffron
#

I use this :

"animations": {
"look_at_target": "animation.common.look_at_target"
},

shell moon
#

Wait

shell moon
midnight saffron
#

..

#

script ? :

scripts": {
"pre_animation": [
"v.rotation_to_camera_0 = -Math.atan2(-q.distance_from_camera * Math.sin(q.rotation_to_camera(0)) - 1, q.distance_from_camera * Math.cos(q.rotation_to_camera(0)));",
"v.look_at_entity = Math.abs(Math.abs(q.rotation_to_camera(1) - q.camera_rotation(1)) - 180) < (20 / q.distance_from_camera) && Math.abs(v.rotation_to_camera_0 + q.camera_rotation(0)) < (60 / q.distance_from_camera);"
]
}

crude oasis
#

Here's the locator

#

Maybe you should put that inside of heads folder together with cube inside the head

shell moon
#
{
  "format_version": "1.10.0",
  "minecraft:client_entity": {
    "description": {
      "identifier": "<entity id>",
      "materials": {},
      "textures": {},
      "geometry": {},
      "scripts": {
        "initialize": [],
        "pre_animation": [],
        "animate": [
          "root"
        ]
      },
      "animations": {
        "root": "controller.animation.player.root"
      },
      "render_controllers": [
      ],
      "enable_attachables": true
    }
  }
}```
shell moon
shell moon
midnight saffron
#

with this it doesn't work :

"animate": [
"look_at_target"
]

shell moon
#

That's shouldn't happen

midnight saffron
#

{ "format_version": "1.20.50", "minecraft:client_entity": { "description": { "identifier": "zelda:activated_ground_guardian", "materials": { "default": "entity_emissive_alpha" }, "textures": { "frame_0": "textures/entity/gnd_guardian/gnd_gua1", "frame_1": "textures/entity/gnd_guardian/gnd_gua2", "frame_2": "textures/entity/gnd_guardian/gnd_gua3" }, "geometry": { "default": "geometry.activated_ground_guardian" }, "render_controllers": [ "controller.render.activated_ground_guardian" ], "animations": { "look_at_target": "animation.common.look_at_target" }, "scripts": { "pre_animation": [ "v.rotation_to_camera_0 = -Math.atan2(-q.distance_from_camera * Math.sin(q.rotation_to_camera(0)) - 1, q.distance_from_camera * Math.cos(q.rotation_to_camera(0)));", "v.look_at_entity = Math.abs(Math.abs(q.rotation_to_camera(1) - q.camera_rotation(1)) - 180) < (20 / q.distance_from_camera) && Math.abs(v.rotation_to_camera_0 + q.camera_rotation(0)) < (60 / q.distance_from_camera);" ], "animate": [ "look_at_target" ] } } } }

shell moon
#

The entity head doesn't move?

midnight saffron
#

no

shell moon
# midnight saffron no

Try using tp then make the entity face you if the head loves them animation works and it's BP problem

midnight saffron
#

with TP the body moves

#

BP :

{ "format_version": "1.20.50", "minecraft:entity": { "description": { "identifier": "zelda:activated_ground_guardian", "is_summonable": true }, "components": { "minecraft:collision_box": { "height": 3, "width": 2.95 }, "minecraft:push_through": { "value": 2.9 }, "minecraft:pushable": { "is_pushable": false, "is_pushable_by_piston": false }, "minecraft:physics": { "has_collision": true, "has_gravity": true }, "minecraft:health": { "max": 500 }, "minecraft:attack": { "damage": 0 }, "minecraft:lookat": { "search_radius": 15, "set_target": true }, "minecraft:behavior.look_at_player": { "look_distance": 15, "angle_of_view_vertical": 0, "angle_of_view_horizontal": 360, "probability": 1, "priority": 1, "target_distance": 15, "look_time": [ 900000000, 900000000 ] }, "minecraft:is_stackable": { "value": true }, "minecraft:knockback_resistance": { "max": 9999, "value": 9999 } } } }

shell moon
#
{
    "format_version" : "1.8.0",
    "animations" : {
        "animation.common.look_at_target" : {
            "loop" : true,
            "bones" : {
                "head" : {
                    "relative_to" : {
                        "rotation" : "entity"
                    },
                    "rotation" : [ "query.target_x_rotation - this", "query.target_y_rotation - this", 0.0 ]
                }
            }
        }
    }
}

This is just animation

#

So it's impossible it doesn't work

shell moon
crude oasis
ember flowerBOT
#
Formatting Your JSON Or JS Code

Please format your code as code-blocks! This makes the text monospaced, and has support for syntax highlighting.

JSON
```json
{
"example": 123
}
```

JavaScript
```js
console.log("Hello World");
```

The character used here is the backtick. This symbol is usually at the top left of your keyboard, occupying the tilde key (~). On mobile, it will be on the second or third page of symbols.

shell moon
#

RP -> animations -> name.json

crude oasis
#

Oh under animation ?

#

It's like animation controller

#

Maybe the name of the bones

shell moon
crude oasis
#

Ok

midnight saffron
#

I have this {
"format_version": "1.20.50",
"animations": {
"animation.common.look_at_target": {
"loop": true,
"bones": {
"head": {
"relative_to": {
"rotation": "entity"
},
"rotation": [
"query.target_x_rotation - this",
"query.target_y_rotation - this",
0.0
]
}
}
}
}
}

shell moon
shell moon
crude oasis
#

If it's under animation it's nothing to change for it blockbench is responsible for that am I right ?

midnight saffron
#

I don't know

crude oasis
shell moon
#

It doesn't matter where you place the bone as long as the bone named head it will animate it no matter what

midnight saffron
#

Do I need a animation controller ?

crude oasis
#

I mean his code under entity folder , is it right in constract?

shell moon
#
{
    "format_version": "1.20.50",
    "minecraft:client_entity": {
        "description": {
            "identifier": "zelda:activated_ground_guardian",
            "materials": {
                "default": "entity_emissive_alpha"
            },
            "textures": {
                "frame_0": "textures/entity/gnd_guardian/gnd_gua1",
                "frame_1": "textures/entity/gnd_guardian/gnd_gua2",
                "frame_2": "textures/entity/gnd_guardian/gnd_gua3"
            },
            "geometry": {
                "default": "geometry.activated_ground_guardian"
            },
            "render_controllers": [
                "controller.render.activated_ground_guardian"
            ],
            "animations": {
                "look_at_target": "animation.common.look_at_target"
            },
            "scripts": {
                "pre_animation": [
                    "v.rotation_to_camera_0 = -Math.atan2(-q.distance_from_camera * Math.sin(q.rotation_to_camera(0)) - 1, q.distance_from_camera * Math.cos(q.rotation_to_camera(0)));",
                    "v.look_at_entity = Math.abs(Math.abs(q.rotation_to_camera(1) - q.camera_rotation(1)) - 180) < (20 / q.distance_from_camera) && Math.abs(v.rotation_to_camera_0 + q.camera_rotation(0)) < (60 / q.distance_from_camera);"
                ],
                "animate": [
                    "look_at_target" <- acts like animation controller 
                ]
            }
        }
    }
}```
#

Guys try reading beginners guide

#

Or watch cyberaxe videos

midnight saffron
#

ok

crude oasis
#

Is there a separate animation controller for look at target?

midnight saffron
#

What is the channel of cyberaxe ?

#

In the docs I’ve already donne all

crude oasis
midnight saffron
crude oasis
#

But I see it, your code is right after pre animation , there's your animate then look at target

#

Sorry for my English

midnight saffron
#

Are you French?

crude oasis
#

No I'm Filipino

midnight saffron
#

Ok

crude oasis
#

Also the leash how to put exactly at the neck of my entity is my problem too

midnight saffron
#

I think it will do the same for me my entity is not aligned

crude oasis
#

Coding is too hard

midnight saffron
#

But I’ve seen people resolve it somewhere there is “default vertical angle ”

crude oasis
#

Sample of one of my entity but i can't code well

crude oasis
midnight saffron
#

I don’t know

#

Here is my entity

crude oasis
#

It's look like big boss

midnight saffron
#

Yes but there is 3 of it

#

Ground the photo
Normal with legs
Sky like a drone

crude oasis
#

Try your head folder move inside the body folder

midnight saffron
#

Ok

#

I will

crude oasis
#

Then try in game if it's work

midnight saffron
#

I can’t now

crude oasis
#

Ok

crude oasis
#

Try this one

#

That is a code for the vanilla pig

midnight saffron
#

This is the same thing

#

I’ve tested to put head in body folder and it did not work

#

I will test this afternoon the locator

crude oasis
#

Name the locator head

#

Me to here I'm experimenting code

crude oasis
#

You should try exactly

#

It's working on me

shell moon
crude oasis