Flying towards Target ?

Question:I have a target in the air, how would I go about setting it up so I have a simple character moves around on the ground but once you would press a certain button the character then moves forwards towards the target in the air deifying physics for what ever he needs to do to that target?

The question is much like the kingdom hearts air fight system, and apparently like air fight system used in the new final fantasy brawling game for the PSP that most likely just came out.

Could this be solve through a combination of logic bricks or will it have to be done in Python. I would like it to be done in logic bricks first because of prototyping reasons.

Thanks, MaggoloVr2

Maybe a combination of a “trak to” and “force” actulators ?

I have tired that already and no Dice man.

edit: It works but not for what I need it to do. I need it to track to the target in the air no matter if the target its high above or far below.

SO does anyone else have ideas on how I could get a flying to attack target in the air feel?

There’s a “3D” button in the track to actuator…

Did you try it?

Note: A force of Gravity * Mass will nullify gravity… if your gravity is 9.8 and your mass is 1, then a constant upwards force of 9.8 will counter gravity.


Yes I did try the ‘3D’ function on tracking, but I would it to quote “fly” towards its target. example: the target pulls player no matter where in the air the target is.

Any thanks

I’m wondering if you did check 3D, because it sure does track in 3D just like the name suggests.

See .blend if you don’t believe me.


track_3D.blend (113 KB)

I should say I feel a little insulted just a bit, but basically I am in need of a dynamic character who can run, walk, attack things, and if need be fly in the air to attack things in the air too.

But thanks

He’s got a point MaggloVr2, it does work. However, i dont’ think you’ve explained yourself too well.

You want more of an AI, don’t you.

First of all, if you can get both objects position in the same py file (to get an objects position, object = objectowner.position), you can use trigonometry to get the angle between them, and from there you can get a vector, and then from there you can point it in the right angle using an ipo, and then get it to move. That works for 2D and 3D, however just in straight lines with no blockages. If you want it to ger around blockages, thats pathfinding, and well, thats a whole 'nother game.

I might work on this slightly over the next month or so.

BTW, if you can get variables between script files (py), you can make more advanced pathfinding. Just make sure you don’t do anything that will make execution of the game hang.

I assume you already know how to make the character run, walk and attack. Now you know how to make it fly, so all you need to do is implement some sort of state system that chooses when best to execute those 4 states. For example, if this AI you can use simple conditions to determine what state to run:
-Short distance to cover: walk
-Long distance to cover: run (interchangeable with walk?)
-Threatened: attack
-Goal/target is above/below: fly

If the character is human controlled than keyboard/mouse sensors can determine the state to run.

As for a proper flying feel you can place multiple nodes between the start and end, you can use maths to determine these node. You can use a beziar curve, maybe add some random offset to each node to imitate turbulence.

As Fake mentioned, if it is AI you may also need some form of pathfinding.

If you wish to avoid feeling insulted in the future, explain yourself a bit better. If need be post a diagram, you will achieve much better results.

@Fake; Have you checked out the Mathutils module? It contains a whole heap of functions for vector and matrix math which simplifies things so much. For example, there is Mathutils.AngleBetweenVecs(vec1, vec2) or Mathutils.Vector is a vector class that allows you to add and subtract vectors, do dot and cross products.

Ok first off let me just state I want something like the flying combat in kingdom hearts for the PS2. Sorry If I was not clear enough.
Now if you dont know what the combat should look like then just youtube it, and I am pretty sure youtube has a video of some one playing kingdom hearts or kingdom hearts 2 with the character flying to attack the enemys in the air.

This is suppose to be a player controlled character not an AI. If it was I would not be asking such a question here. So here a question for you guys to answer in the form of what I want:

Character has locked onto target.

The target is in the air mocking the character.

The character the moves or flies straight towards the target as if he was being pulled towards the target in the air.

The Question would be, if one was to use a state system how would you make it so the character ‘flies’ right into the target to matter where the target is?

The reason for the insult was because it was the .blend you gave me was just a cubed animation with a cone following it without some of the variables or dynamical properties I needed.

If you would like a better idea of what I want then ask, and I shall post maybe a video of an animation of what I want but in simplicity terms. Okay?

Thanks again.

Ah, I think I understand. You want the player to ‘fly’ to the target when the player attacks.

So, if the player is locked on, attacks the target but the target is above the player, you need to move the player close enough to attack.

I attached a .blend

Space makes the player jump to the target. The jumping would be a state, once that is finished you could initiate the attack state. (can be done where ‘player[‘flying’] = False’ is executed)


jump_to_target.blend (96.9 KB)

Thanks my questions have been answer I needed python… I would like logic bricks only for this, but something did tell me it will not work the way I want it to.

Thanks 101