Object dragged in x and y direction when we move around. (Question)

Hi, I wonder if we can make 2D and/or 3D object to move along when we move the device?
Like literally pan the device.

Example: We put the object in the middle of the screen. If we move the camera upward, then the object kinda left behind with some exponential smoothing, until we stop, then it will try to catch up, overshoot a little bit, and goes back to the original position.

So it’s like a toy with a spring. Maybe similar to @josh_beckwith 's slinky cheek, but it moves based on the camera movement, not the head.
Any idea how to do it in patch editor? I prefer a method without script, since i have no idea how to use script. Thanks!!

1 Like

I haven’t done this in spark, but I think you can with the bounding box patch. It will give you the current position of the object, and you can modify it and send it to the position input. For some basic smooth movement, you’d take the difference of the current and target position, multiply it by a small number, then add it to the current position.

For the springy overshoot behavior, you’d need to add in some velocity and acceleration variables. I think a good book for that is The Nature of Code (although it’s been a while since I read it). Edit: yeah the first 4 chapters look like what you need.

1 Like

I tried it out and it works pretty well! It’s a bit of a pain to set up though…

spark-elastic.arprojpkg (20.0 KB)


Oh… my… god… you got it! Siiiiick!!! I’ll take a look at it, try to understand it and hopefully learn something new from it. I think you nailed it on point josh! Unbelievable .

1 Like

I did this from memory so it’s probably not the best way to do it. I’m almost certain there’s something wrong with it :slight_smile:

If you read the first few chapters of the book I linked to, I’m sure you can make something more robust

1 Like

ah this answers exactly what I’ve been looking for in terms of latent camera following!!!

awesome. i’m glad you find it useful! can’t wait to see how you implemet this method to your filter :smiley:

1 Like