Game Development Community

Clone/copy should include linkpoints

by Joe Rossi · in Torque Game Builder · 05/18/2008 (1:25 pm) · 5 replies

Unless I'm mistaken, clone and copy functions won't copy linkpoint data to the newly created objects. Would be nice in the future if TGB could do this for us. I'm having to manually recreate linkpoints in script to work around it.

#1
05/22/2008 (1:59 am)
In case anyone is wondering, the cloneWithBehaviors function does copy all linkpoint IDs over to the new object. The other clone and copy functions don't seem to. Seems odd considering linkpoints aren't related to behaviors (as far as I know).
#2
05/22/2008 (11:58 am)
CloneWithBehaviors unfortunately copies the data over in a completely custom way due to it's need to do things in a certain order to register behaviors and ensure they get the proper object callbacks when the new object is cloned. This unfortunately has created a gap in functionality and redundant code. This doesn't really help you though I thought you did deserve an explanation of why it was behaving the way it does :)
#3
05/22/2008 (1:13 pm)
Joe,
To work around link points in my projects, I define a "t2dSceneObject::onSpawn(%sourceObject)" function in game.cs that I manually call after each clone/copy function. This onSpawn function is filled with whatever data I need copied from the source to the cloned object.
#4
05/22/2008 (7:17 pm)
Thanks guys, I was able to do what I needed :)
#5
03/17/2012 (2:12 pm)
This is still a problem. CloneWithBehaviors still works fortunately!