.getLastCreatedObject() in 2.34

Well I’ve been tring to use it to assign particles to a particle system so that more then one particle system can run at a time, but I cannot to get this to work.

All it prints is “None” or just white space…


it works fine

it returns the object added on the last frame, and I guess you should be printing the id of it to see if it is different…

I made a bullet hole script once, look at it

=_= okay i see so its not ment to print out the name rather just link it to the object owner… thanks

okay Ima lil confused…

lastObj = act.getLastCreatedObject()
print dir(lastObj)

“[‘applyImpulse’, ‘disableRigidBody’, ‘enableRigidBody’, ‘getLinearVelocity’, ‘ge
tMass’, ‘getMesh’, ‘getOrientation’, ‘getParent’, ‘getPhysicsId’, ‘getPosition’,
‘getReactionForce’, ‘getVelocity’, ‘restoreDynamics’, ‘setOrientation’, ‘setPos
ition’, ‘setVisible’, ‘suspendDynamics’]”

so then I try:
print lastObj.getPosition()

AttributeError: ‘NoneType’ object has no attribute ‘getPosition’

I wanted to access the properties I added to the object I am creating, but I cant even get that…What am i do wrong

as I said before, it returns the object created on the LAST frame

you probably were not printing the dir of it, and lastObj.getPosition() on the same return, but on different ones
if no object has been added yet, it will return none
[I used a property to tell me if I have added an object on the last frame, then I place it on the current frame…]

and, iirc, once you have added an object, if you don’t add any more it will keep returning the same object

The problem:

I was calling upon the lastobject before:

G.addActiveActuator(act, 1)

its works now thanks (now I just need to rearrange a few things