Linking Groups - Game Logic - Track To

Hello Guys

I’m trying for long time now, but didn’t figured it out… maybe always looked the wrong places…
I’m having a main file and a libary file.
In the libary file there’s a group.
An item of the group has the GL actuator “Edit Object” - “Track to”.
Now I wanna track an object in the main file when this group is placed there.
First, I can’t enter the object, the group/the object should track to.
When creating a same named object in the libary file, I can enter a object name, but still there will be no tracking in the main file.
So how can I get my object in the main file be tracked by the object from the libary file with linking a group?

Thanks for answers :slight_smile:

You can’t!

All parameter’s in the SCA are verified to prevent invalid values. If you enter an objet name it is verified to exsist and to be the right object type.

The problem

You can’t configure objects that do not exist.

This belongs to linked and added objects. While you can’t even enter the objects name when using linked groups, you canenter the objects name if the object is at an inactive layer. The most BGE users forget that this parameter will be fixed to exactly that object, even if you can’t see it (it is inactive).

The solution
What you can do is to set the parameter at runtime.
You need a Python controller to do that. The concept is quite simple:

A) Identify the object to be set
B) Set the parameter with the reference to this object or the name of the object dependent what the parameter accept.
C) Activate the actuator (some actuators needs to be activated to take over the new parameter) - you can do this with logic bricks too

e.g.


# A)
myTargetObject = ... 
# B)
trackToActuator.object = myTargetObject
# C) optional
cont.activate(trackToActuator)

Check TrackTo and added Objects for much more details.

Monster