hi Kassen,

i'm not sure if this is expected behaviour, but particles are facing the camera, whose direction is calculated and rendered in the current state. if previous states have rotation, then the particle sprites will be rotated i guess.

there's a probably nasty hack you can try. instead of one locator, you can use two. you transform the first locator as usual, then the second should get the inverse transform of the first locator's rotation. i'm not sure why this does not work with applying the inverse tranform to the particles, but with two locators it seems to work.


(clear)

(define p (build-particles 512))

(define l (build-locator))

(define l2 (build-locator))

(with-primitive p
    (pdata-map!
        (lambda (p)
            (srndvec))
        "p")
    (pdata-map!
        (lambda (c) 1)
        "c")
    (parent l2))

(with-primitive l2
    (parent l))

(define (mainloop)
    (with-primitive l
        (identity)
        (translate (vector (* 2 (sin (time))) (* 2 (cos (time))) 0))
        (rotate (vector 0 (* 10 (time)) 0)))
    (let ([m (with-primitive l (get-global-transform))])
        ; delete translation
        (for ([i (in-range 12 15)])
            (vector-set! m i 0))
        (with-primitive l2
            (identity)
            (concat (minverse m)))))

(every-frame (mainloop))


best,
gabor

Reply via email to