#How can I make a particle function face the direction the player is looking?

1 messages · Page 1 of 1 (latest)

lucid thistle
#

I am currently making an origin based on Elemer of the Briar from Elden Ring, however, because I need help with specifically a function, I felt I'd make a question post here rather than in the origins discord as it is somewhat unrelated. I am having issues with making a particle slash function face the players direction as in the correct orientation.

Version 1.20.1 Forge
Attached below is a video of the function not showing up as intended as well as the function itself, apologies if the quality is bad
https://files.catbox.moe/mi8imv.mp4

sinful trench
#

You need to use the executecommand with at and anchored eyes arguments

#

and maybe positioned ^ ^ ^2

lucid thistle
#

in the function itself?

sinful trench
#

If it's only for the particle, you would put that command in the function yes

lucid thistle
#

alrighty I'll try it out and see if it works

dry kelp
#

If you see yourself writing that line more than once. Create a function that calls your function after the execute chain

lucid thistle
lucid thistle
dry kelp
lucid thistle
#

so, if I were to make a function for my slash (lets say its called eochaidslash) function, would it be like

execute at @s anchored eyes positioned ^ ^-0.4 ^2 run function eochaidslash

?

dry kelp
#

The flame function can then use coordinates relative to the executor again like:

# at the origin
particle flame ~ ~ ~ 0 0 0 0.05 0 force
# to the left of origin (as viewed from the player)
particle flame ^-3 ^ ^ 0 0 0 0.05 0 force
# above the origin
particle flame ~ ~3 ~ 0 0 0 0.05 0 force
lucid thistle
dry kelp
#

Local coordinates with a caret ^ take into account rotation and thus shift things a lot

lucid thistle
#

so if i wanted it -0.4 just on the y axis, would i use a tilde instead?

dry kelp
#

If I look straight west (negative X) and up the -0.4 will be west

#

You can't mix local and global coordinates

lucid thistle
#

good to know

dry kelp
#

You can however stack them

#

Much like how I did in my example

lucid thistle
#

hm

#

somewhat off topic but my particle function is around 290 lines long, would that make a difference in how i'd tackle this situation or would it be the same

#

function is all the particle command

sinful trench
#

I didn't watch the video before but now I understand better

#

So indeed you should use the execute command to call your function

#

execute at @s anchored eyes positioned ^ ^ ^x run function <particle>

#

The execute command will change the center of execution of the command and the rotation context

#

However since your particle commands use tilde notation, your overall effect won't be rotated

#

You need to use carret notation in your function to take the rotation into account

lucid thistle
#

when changing the tilde to carets, it ends up doing what I want it to, but just in the incorrect rotation, let me see if i can get a screenshot of it

sinful trench
lucid thistle
#

I see, sorry for the misunderstanding

dry kelp
#

if you still get an unwanted rotation you might need to add another argument to the execute chain.

It helps if you try to provide a screenshot of what you want/expect vs what you get if you can make such a screenshot.

lucid thistle
dry kelp
#

It can help yes

lucid thistle
#

not sure if this makes sense

#

heres a video of the incorrect thing happening, what would I add to my execute function?

sinful trench
#

You need to change your particle ommands from using ~ ~ ~ coordinates to using ^ ^ ^ coordinates

#

~ won't keep rotation

lucid thistle
#

they are using ^

sinful trench
#

Please send a video with different execution angles

lucid thistle
#

I'll try

lucid thistle
#

sorry it took a bit had to install a freecam mod

rugged nova
#

yea it looks like the animation is just rotated 90 degrees for some reason. Just add an offset using execute rotated ~90 0

#

aha but you're not using ~ ~ ~ in your particle function

#

you should use ^ ^ ^ instead

rugged nova
lucid thistle
#

just did, seems to work perfectly as intended now lol

#

thanks so much!