It works but i want to avoid velocity.set(…) method cause i have some other things that alterate velocity and this overrides all of them each frame.
Moreover, var force defines speed AND radius in this case which is not desired :s
Diclaimer : I’m not a math guru, so I tend to not use math when I can avoid it.
So…first thing that comes to my mind is why are you using math?
The engine does math for you.
If you want soemthing to orbit around (0,0,0) put a node in (0,0,0), put the geometry in that node, offset it by the radius of your circle and then instead of moving the geom, rotate the node.
Even if you want to modify the velocity you can find a way to to have a rotation velocity instead.
Does it sound reasonable?
Hum yes, i have already done this kind of things many times…math…math u_u.
But i can’t use this in that case :’(. To be more precise, it’s for some kind of particles…so i can’t have one geometry for each particle that orbits ^^. I only have math data in hands…
You could use a quaternion to rotate the particles around a point.
Else, let your velocity move the particle and then take a vector representing the line from the object to the center of the circle… then move the position (not velocity) to the center so that the vector has a fixed length.
But you will end up doing length() which does sqrts and stuff.
Way easier to just do quaternion.mult(pos) instead of messing with velocity. Then your velocity just becomes how fast you rotate the quaternion.
With this equation the parameter t is pretty much your time, or tpf. Your circle is then represented by Center, in your case (0,0,0) and azimuth and elevation angles.