Float - Follow - Orbital movement

Due to some good suggestion of adding a support for my game character. I would like design a small device, that funcions like a pet of Keisha.

This should be a floating object, htat will basicly help the character to collect items, solve crowded enemys and do additional damage. This object ought to be a ghost, without physic simulations

In the game it should be able to follow the character in the air, and for a specific situation, it should make an orbital movement around her body. Which is visualized in the picture here…


Thanks for you help!

Two ways:

A) have an “center object” that rotates. The orbiting object is parented to the center at a certain distance (radius).
B) just have the orbiting object. Let it move forward and turn (left or right) at the same time. The ratio between motion and turning will determine the curve and therefore the center (if the motion forms the circle).

thanks Monster,
i thought about the first option . but i need a smoother movement of the object instead of a stiff motion around the character. If the character is kinda moves so fast away, the thing will try to get into the rotation again.

the second option is not stable i guess…

You can slow parent the central object to the centre-of-mass of the player. Then, rotating this with the appropriate keyframes will look fine, I imagine.

have it move at a list of points but the trick is the list is using the players local orientation and position. Also, have the motion be relative to thr distance to the next point

(the list of vectors you need to make, is like taking the player and moving him to zero,zero,zero, and setting his rotation to zero,zero,zero)

an easier method is to work this backwards,

TargetPos = target.worldPosition.copy()

TargetPos-=own.worldPosition
TargetPos = own.worldOrientation.inverted()*TargetPos

this localizes the position of a target. (to build your list)

I Think *

localPoint=object.worldPosition+(object.worldOrientation*Vector(localOffset))

Dist2Target = own.getVectTo(localPoint)[0]
Vect2Target = own.getVectTo(localPoint)[1]

and use those to define the actors motion.

Another approach is following:

C) give the orbiting object logic that it tries to get a constant distance to the target (like the camera actuator). Combined with a forward motion you should get a sort of orbiting.

Test_file.blend (537 KB)

You can also try to parent(CTRL+P/Object) the floater to an empty, then vertex parent(CTRL+P/Vertex) the empty to the character and rotate the empty with logic brick or python

Thanks all. i dont know how to use vector but i think there is a function called “lerp” that align positions of things. Is it possible to make the orbiting object align itself to any circle and move on it?

@BRP tangental movement is super O.O how can we do that?
@Monster i know how the camera actuator works, but how can i apply that onto a non camera object?
@guramarx no, its not the effect i want to achieve. the object should ‘freely’ move around , can fly away, and can follow the character.

The camera actuator acts like a camera man (camera man actuator would be the better name ;)).

This actuator influences the position of a game object. There is nothing specific to a camera itself (like lens shift). So yes you can use it that way.

But, the camera actuator tries to keep the object at a certain position/line relative to the observed object. That is not what you want. You want the object to circle around the master. So I guess the camera actuator is not satisfying your needs. But you can use the same principle: if not in orbit … try to move to the orbit.

thanks Monster

i can use lerp function of vector module to make the object follow the target. what i would like to achieve now is the circular movetion. Is is possible to make an object move on a circle curve?

In your case it should be pretty simple:

Move towards the orbit (with what you already developed)
Additional move sidewards (or forward) as long as it does not move directly to or away to the center of the orbit it will result in a motion on orbit. The correction will follow the next frame, so the final orbit might be a little bit bigger than the desired orbit.