creating a fake origin point in the BGE?

in the figure below you'll see two separate points in time and three object. You can also see the direction object C is facing.

I am trying to replicate a false point of origin for object B at the center of object A, which will then orbit around A based on the direction of object C in the BGE using python. parenting object B and A are not allowed, in fact no parenting is allowed in this example, neither is rotating object B based on the rotation of object A.

how would I accomplish this in the bge using python?

It took me a while to figure out just how to articulate this, and to keep it clear what I want to do. I thanks for any help in advanced.

EDIT: here's what I have so far, this goes on an always sensor to python actuator on object B. It however doesn't set the angle of the object properly.

    #------------------------------------------
print("------------------")
import math
import bge
from bge import logic
scene = bge.logic.getCurrentScene()
cont = logic.getCurrentController()
contrlr = bge.logic.getCurrentController()
own = contrlr.owner
obj = scene.objects['C']

#horizontal
x0= obj.worldPosition.x
y0= obj.worldPosition.y
y= 0
x= 0
(dx, dy) = (x0-x, y-y0)
angle = math.degrees(math.atan2(float(dy), float(dx)))
if angle < 0:
angle += 180

#vertical
z0= obj.worldPosition.z
x0= obj.worldPosition.x
z= 0
x= 0
(dx, dy) = (x0-x, z-z0)
angle2 = math.degrees(math.atan2(float(dy), float(dx)))

angle=angle
angle2=angle2+180

if angle2 < 0:
angle2 += 180

print("A1A2",angle,angle2)
#get C's angle from the centerpoint /\
#############################################
#now set the objects angle
import sys
import bge
import random
import math
from bge import logic

scene = bge.logic.getCurrentScene()
cont = logic.getCurrentController()
contrlr = bge.logic.getCurrentController()
own = contrlr.owner
obj = cont.owner

angle2=angle2-90
A=angle*-1
T=angle2

obj.worldPosition.x = R*math.sin(T)*math.cos(A);
obj.worldPosition.y = R*math.sin(T)*math.sin(A);
obj.worldPosition.z = R*math.cos(T);
print("tapos",T,A,obj.worldPosition)



hope this edit helps.

• I dont know BGE but can you place in an empty and parent your object to the empty? That should solve your problem. Your anchor point should be the empty. Jan 10, 2019 at 17:35
• "parenting is not allowed in this example" Jan 10, 2019 at 20:25
• The only thing I can think to do really is to create a circle, and then match the object in the allowed points in the circle to the camera. And I don't really know how you'd do that regardless it doesn't seem like a very effective method, any suggestions? Feb 20, 2019 at 19:06
• @Frederick and what is supposed to be the result of your question, a satellite of a planet or objects spinning around another object?
– user58715
Jul 4, 2019 at 22:17
• B follows C while spinning around A. So both I guess? Jul 5, 2019 at 6:27