# TrackTo with Python?

I have an idea for a game which involves orbiting a spherical world, and I tried using the Track To actuator to aim the actor’s “feet” toward the ground, but I’ve found that whenever the actor crosses the sphere’s Z axis, it gets confused and is not sure which way to point. It will only travel due north, and when it gets to the pole doesn’t know where to go. Here’s a test file showing the problem. (Press W to orbit).

I suspect that a better way to do this could be done with Python, but it’s beyond my own scripting skills as they stand. Anyone care to lend a hand or at least give me a hint?

ok PlantPerson
if your want to create a trackto with python you need
learn some of used of matrix you can read this manual:
http://www.luma.co.za/labs/tutorials/rotation.zip
here a example :
http://files.filefront.com/PYTHON+trackToblend/;8494513;/fileinfo.html
in this example your you have two points to move for the trackTo
one Object : Cursor keys : up-down-lef-right— + and (green cube )
two a Virtual point ( only exist in the script) Keys: w-s-a-d—z-x(yellow cube)

I tried your script, POCHO, but it has the same flaw that the built-in Track To has.

I don’t think I have the knowledge of mathematics needed to code such things myself.

give some Time
and the function matrix script dont is my
is write for Herman.Tulleken:

Even though POCHO can barely speak english, he is right when he points to hermans examples.

If you want bug-free tracking, modifying one of his examples to suit your needs would probably be the most advanced option.

or

If you don’t need anything more complicated than just “walking on a sphere”: Did you ever think about parenting the player to the empty in the center of the sphere, and then rotating the empty?

Again, I don’t know what sort of complexity you really need here, but there are definitely options out there.

As for hermans “tutorial”, yea, he needs to dumb that down if he expects it to be useful to anyone other then him. Not everyone is a math major, he should keep that in mind when writing tutorials (if I can do it, so can he).

Thanks for your reply, Social. I actually tried various types of centered-empty type thing, but so far as I can tell, it’s not possible for the actor to be collision-sensitive under such circumstances.

The game would involve not walking on the sphere but flying around it, and avoiding obstacles which project from it. I conceived of the sphere idea mainly so that the environment could be “endless,” otherwise players could end up getting to the edges of the environment, and I’d have to find some way to get them back where they belong.

Ahh, I see. In that case you could use the good ol’ “Bermuda Triangle” technique. Just set the virtual bounds and write a teleportation script, so that whenever the player hits a specific boundary, his position resets to the opposite end.

Of course, you would need to use some fog effects to make the transition seamless, but it would work quite nicely.

Even better than the sphere imo.

How about parenting another empty to the center empty, and then just having your player object copy the parented empties’ position & orientation?

That way you could still keep it dynamic for the collisions, but without all the “freak-outs” of regular parenting.

PS:
Does anyone else think that taking out static-static collision caused more problems than it actually solved?

I didn’t really appreciate how helpful that functionality was, until I didn’t have it anymore. Now I have to rig a raysensor array to produce a similar effect -> the very essence of bullshit.

You mean taking it out solved problems?

Heh, good one.

Ummm, I dont know if I understand correctly or not… but you could move the center of the player to the center of the sphere?

Then only use the drot to rotate around the center when the player moves?

Maybe…

I completely agree with you here. Having to rig up a ray sensor or a timer property or other methods for EVERY non-dynamic object is a major pain.

~~Stu