#particle custom variables?

1 messages · Page 1 of 1 (latest)

crystal wind
#

I am trying to make a tool where when you use it it will draw a ray from the player's look direction and then spawn a particle. that particle will have a different color based on the length of the ray. is there a way to make a custom variable that I can change using scripts that I can use to change the appearance? or set an existing variable native to particles?

cinder turtle
#

nuh uh

#

the only way i know is just to make alot of different particles

#

not sure, but i think particle variables are unavailable for scripts or any other thing

crystal wind
#

cool thanks

simple ingot
#

You can spawn a particle from script and pass initial values for variables via molang variable map. Tho since you can only pass initial value, you'll have to constantly spawn new particles while passing new values since you can't just spawn one effect and then change its variable values afterwards

#

Although if you spawn a particle from player entity (by editing client player.json) you'll be able to query different player related values directly from the particle

crimson gorge
#

You can have one emitter update its own variables after receiving those intial values though.

#

Say you have an initial Vector3 for the direction to cast a ray in. Each time you spawn one, increment the value of a scalar and multiply the direction by that scalar.

"minecraft:emitter_shape_point": {
  "offset": [
    "v.offset = v.offset + 1; return v.dir.x * v.offset;",
    "v.dir.y * v.offset",
    "v.dir.z * v.offset"
  ]
},
"minecraft:emitter_rate_steady": {
  "spawn_rate": 10,
  "max_particles": 200
}
#

@crystal wind