#Why does my entity not like to rotate bruh???
1 messages · Page 1 of 1 (latest)
What’s the behaviour file look like?
Does it always have a target? and it cant target you if you are in creative mode.
you have the animation set to the query target rotations, so it always needs a target in order for it to rotate to that target
in your behavior file you should have a component like nearest attackable target so it is always searching for a target nearby
{
"format_version": "1.16.0",
"minecraft:entity": {
"description": {
"runtime_identifier": "minecraft:arrow",
"identifier": "traye:blue_lazer",
"is_spawnable": false,
"is_summonable": true,
"is_experimental": false
},
"components": {
"minecraft:damage_sensor": {
"triggers": [
{
"cause": "all",
"deals_damage": false
}
]
},
"minecraft:collision_box": {
"width": 0.25,
"height": 0.25
},
"minecraft:projectile": {
"on_hit": {
"remove_on_hit": {},
"impact_damage": {
"damage": 1,
"knockback": true,
"semi_random_diff_damage": false,
"destroy_on_hit": true
}
},
"power": 1,
"gravity": 0,
"inertia": 1,
"liquid_inertia": 1,
"uncertainty_base": 0,
"uncertainty_multiplier": 0,
"anchor": 1,
"offset": [
0,
-0.1,
0
]
},
"minecraft:despawn": {
"despawn_from_distance": {
"min_distance": 10,
"max_distance": 3000
},
"despawn_from_inactivity": true,
"despawn_from_simulation_edge": true,
"min_range_inactivity_timer": 1
},
"minecraft:body_rotation_blocked": {},
"minecraft:physics": {},
"minecraft:pushable": {
"is_pushable": true,
"is_pushable_by_piston": true
},
"minecraft:conditional_bandwidth_optimization": {
"default_values": {
"max_optimized_distance": 80,
"max_dropped_ticks": 7,
"use_motion_prediction_hints": true
}
}
},
"events": {}
}
}```
I just want it to rotate to where ever I want it to go
body_rotation_blocked will need to be removed for sure as that prevents the ability to turn
ok ill try it
it still doesn't like to rotate like the video
help
What’s your goal with this projectile? It’s supposed to turn to face the target I understand but is it a projectile that you’ll be shooting or how will that work. I’m thinking that the q.target_body_x_rotation is only available to use when the entity has the target behaviour, I’d recommend adding that to see if it allows your animation to properly work next
its suppose to be a lazer that you shoot from a lazer gun
What happens when you actually shoot the projectile? Try making an item with the throw component and test to see if it gets the rotation from the source that fires it, you may not need this part at all I think
I’ve always used invisible projectiles and particles for my lasers
if (itemStack?.typeId == "cg:blue_laser_gun"
// && player.getItemCooldown("chorusfruit") == 0
) {
player.startItemCooldown("chorusfruit", 60)
const {x,y,z} = player.location
const {x:h,y:i,z:j} = player.getViewDirection()
const {x:a,y:b} = player.getRotation()
const lazer = world.getDimension("overworld").spawnEntity("traye:blue_lazer", {x:x,y:y+1.5,z:z})
lazer.playAnimation("animation.blue_lazer.default", {blendOutTime:999999})
lazer.teleport(lazer.location, {rotation:{x:a,y:b}})
player.playSound("cg.fire")
const lazerProj = lazer.getComponent("projectile")
lazerProj.owner = player
lazer.setRotation({x:a,y:b})
lazerProj.shoot({x:h*4,y:i*4,z:j*4})
}```