I'd like to animate an object 180 degrees around but I want other objects on top of that object to move with it as if glued into place.
I'm reading through the jt_vectors library and my brain is oozing out of my ears a little bit. I figured I better check and see if there is an easier way to achieve this effect. I'm worried I won't be able to figure it out on my own.
ID:2010352
Jan 1 2016, 10:53 pm
|
|
In response to Reformist
|
|
Reformist wrote:
All you need to do to get objects to orbit around another is matrix transformations using translations of polar coordinates (x,y). > OrbitingOrbit() Essentially all you need to do is translate the main object, translate all oribiting objects by the same amount, and then apply the orbiting object's transformation to its previous transformation. This comes real close to what I need. Thank you for sharing it. The center will spin in place so I was able to simplify the code a bit. The following code has the satellite orbiting but relative to itself instead of my other object. var/matrix/m = new How can I specify my other object as the center? |
I need to switch it over to pixel movement to retain other transforms. This seems to be working fine although I still need to define a center.
var/matrix/m = new |
So the main object isn't going to move at all? If that's the case, then I suggest getting two of Kaiochao's libraries:
Absolute Positions: http://www.byond.com/developer/Kaiochao/absolutepositions Map Info: http://www.byond.com/developer/Kaiochao/mapinfo Absolute positions requires map info. Absolute Positions will give you access to Cx() and Cy(), which return the absolute coordinates of an atom's center. You could use this to get the center of the atom you want your satellite to orbit around. |
Kaio actually has a good post about this:
http://www.byond.com/forum/?post=1554647#comment9775199 |
It's crude, but this is what I came up with to test it.
Essentially all you need to do is translate the main object, translate all oribiting objects by the same amount, and then apply the orbiting object's transformation to its previous transformation.
This is what happens with this code.