#Rotate particle to another particle

1 messages · Page 1 of 1 (latest)

cold whale
#
  set {_reference} to vector from yaw {_yaw} + 90 and pitch 0
  set {_v} to spherical vector with radius {_radius}, yaw 0, pitch 0
  loop floor(360 / {_step-size}) times:
    set {_temp-v} to {_v}
    if {_pitch} is not 0:
      rotate {_temp-v} around {_reference} by {_pitch}
    set {_locs::%loop-number%} to {_center} ~ {_temp-v}
    add {_step-size} to yaw of {_v}
  return {_locs::*}```
#

circle function ^

#

I think you can just use this with the other particle as it’s center

cold whale
#

then swap the particles, or wdym?

primal vault
cold whale
#

I don't get your issue

cold whale
#

you want the end rod particle around the soul?

primal vault
#

i want it so that the soul will rotate on the end rod

#

in the image here, its not rotating (not spiraling)

cold whale
#

so how is this wrong then?

primal vault
#

it is not spiraling

cold whale
#

oh

#

you have to use sine for that

primal vault
cold whale
#

yeah the wave thing

#

1 sec

primal vault
#

alright, thank you!

cold whale
#

okay I can't find it rn but I think I got something similar but I'm not home yet

#

I'm not sure, I really don't exactly remember how it was done again, I'll check how I did it soon

primal vault
#

alright, thank you! Just ping me anytime

cold whale
primal vault
#

bump

cold whale
#

I can't find my thing anymore but I'm trying to recreate it

primal vault
#

thank you sir!

primal vault
#

bump

cold whale
#

I'll just go for the easy way and not try to use waves

#

after you showed me the video I wanted to try it for myself too xD

#

I'll ping you once I've made some progress on the spiral

rotund quail
#
  1. get vector from player's pitch & yaw
  2. get a reference vector from normal yaw and pitch +/- 90
  3. set ref's vector length to spiral radius
  4. rotate ref around vector
cold whale
#

yeah I was gonna do that now

cold whale
#

idk what I did wrong but it's making an 8 now lol

cold whale
#

figured it out

cold whale
cold whale
#

(sorry if I pinged rage grim, if I did I didn't mean to)

cold whale
rotund quail
#

why not

cold whale
#

bc I'm stupid currently, I can't figure out what I'm doing wrong

#

I'm probably not even close

#
      set {_v} to vector from yaw {_e}'s yaw and pitch {_e}'s pitch
      add 1 to {_n}
      set {_n} to 1 if {_n} > 12
      set {_o} to vector from yaw {_e}'s yaw + 90 and pitch {_e}'s pitch + 90
      set {_o}'s vector length to 0.5
      rotate {_o} around {_v} by mod({_n} * 15, 360)
      #particle stuff at {_e}'s location ~ {_o}```
#

this isn't the entire code but it's the part that does the spiral

rotund quail
#

ref only needs a higher pitch

#

yaw should stay the same

cold whale
#
  • it's all in a while loop
#

wait

#

bruh I'm stupid

rotund quail
#

also yk %loop-counter% exists now

cold whale
#

does that work for while loops?

rotund quail
#

yeah

cold whale
#

okay then I'll use that

#
      set {_v} to vector from yaw {_e}'s yaw and pitch {_e}'s pitch
      set {_n} to mod(loop-counter, 12)
      set {_o} to vector from yaw {_e}'s yaw and pitch {_e}'s pitch + 90
      set {_o}'s vector length to 0.5
      rotate {_o} around {_v} by mod({_n} * 15, 360)
      #particle stuff at {_e}'s location ~ {_o}``` idk what I did wrong this time but now it looks weird at certain angles
#

weird yaws and pitches: 0, 45 180, 45 0, -45 180, -45

#

actually anything with about a 45/-45 pitch looks a bit off

rotund quail
#

set the vectors outside of the while loop

#

and make the rotation a constant instead of using modulo

cold whale
#
    set {_o} to vector from yaw {_e}'s yaw and pitch {_e}'s pitch + 90
    set {_o}'s vector length to 0.5
    while ...:
      loop 64 times:
        set {_x} to mod({_x} + 1, 360)
        rotate {_o} around {_v} by 360/64
        lerp 3 of dust using dustOption(color({_x}), 0.5) at {_e}'s location ~ {_o}``` got this rn
#

(ignore the {_x})

#

it's still acting weird for 45/-45 pitches

#

it's like a disc

rotund quail
#

looks fine to me

cold whale
#

now I'm confused

cold whale
#

for some reason 45, 90/-90 works fine but 45, 180/0 doesn't

rotund quail
#

works fine for all angles idk

cold whale
#

is there even any difference between your one and my one? (besides the while loop)

rotund quail
#

colour, draw location, step size

#
on rightclick with kelp:
    set {_e} to player
    set {_v} to vector from yaw {_e}'s yaw and pitch {_e}'s pitch
    set {_ref} to vector from yaw {_e}'s yaw and pitch {_e}'s pitch + 90
    set {_ref}'s vector length to 0.5

    loop 30 times:
        rotate {_ref} around {_v} by 360/30
        draw 3 of dust using dustOption(red, 1) at location 1 infront of {_e}'s head ~ {_ref}
        
        mod(loop-value, 4) = 0
        wait 1 tick```
can copy paste it and see if it still has problems
cold whale
#

k it worked

#

first 4 lines are identical so that can't be it

#

loop 30 times or loop 64 times shouldn't matter

#

the rotate is the same too except for the amount but the proportion is the same

#

and the particle spawning is the same

#

I don't get what I did wrong

#

I'm guessing it must be the while loop

#
  set {_v} to vector from yaw player's yaw and pitch player's pitch
  set {_o} to vector from yaw player's yaw and pitch player's pitch + 90
  set {_o}'s vector length to 0.5
  loop 64 times:
    set {_x} to mod({_x} + 1, 360)
    rotate {_o} around {_v} by 360/64
    lerp 3 of dust using dustOption(color({_x}), 0.5) at location 1 infront of player's head ~ {_o}``` this worked
primal vault
#

hello just woke up

#

wondering how could i integrate that to my code so that it spins around the end rod

primal vault
cold whale
#

or whatever you used to get it's movement

primal vault
#

ok i'll try

cold whale
#

how did you make the line move?

primal vault
#

set {_f} to location {_m} meters infront of {_beam}

cold whale
#

put the set vector stuff outside of the loop (not the rotate)

#

wait where is your main vector

primal vault
#

main vector, the beam?

cold whale
#

no

#

you didn't set it

primal vault
#

this what it looks

#

ohh figured it out now!

cold whale
#

increase the amount that it rotates by

cold whale
primal vault
#

THANK YOU SO MUCH!!!

cold whale
#

does it work correctly in these directions:

primal vault
#

@cold whale @rotund quail thank you for the both of you, sorry for ping!

primal vault
primal vault
#

looks like this now

cold whale
#

I can't really see it

primal vault
cold whale
#

that's correct right?

primal vault
#

yeah that's already good for me

cold whale
#

want it colored? ;D

primal vault
#

hope so but idk how you did the color function XD

cold whale
#
        lerp 3 of dust using dustOption(color({_x}), 0.5) at {_l} ~ {_o}

function color(x: integer):: color:
  set {_r} to (sin({_x}) + 1) * 127.5
  set {_g} to (sin({_x} + 120) + 1) * 127.5
  set {_b} to (sin({_x} + 240) + 1) * 127.5
  return rgb(round({_r}), round({_g}), round({_b}))```
primal vault
#

thank you!!!!!!

cold whale
#

np