objectAdd is an object reference, not an object id.
var wantPos = scenes.Document.objects.PosPoint.pos;
wantPos.y=scenes.Document.script.MousePosPointUpVector; // I think you need a float here, not a vector...
var objectAdd = scenes.Document.objectAdd("FeatherEmitter_"+system.timer, // object name
"ParticleEmitterHolder", // object mesh
wantPos, // object pos
null, // default (0,0,0)
new Vector(.251, .251, .251)); // scale
var objEmitter = scene.Document.objectAdd("FeatherTrueEmitter", "emitter", objectAdd.pos);
objEmitter.attach(objectAdd.id, "", true, false, false);
// yadda yadda yadda I would suggest NOT using the system timer if you plan to create more than one of these in an instant. The reason is that you can create several things in one update cycle, which will all have the same system time IE the same ID. You could use a counter 'objCounter'.
objectAdd... "FeatherEmitter_"+(objCounter++);
I also will usually use the object id that I am attaching to, since they have to be unique usually.
var objEmitter = ... "feather_emitter_"+objectAdd.id ...
Now you know what object it is attached to, and that its a feather emitter. If you need to for some reason, you could object.id.slice(("feather_emitter_").length) and now you have the object ID of the parent.
Sorry, this is a lot more than you asked for. Use what you want, disregard the rest.
|