Mounted memory leaks?
by bentgarney · in Torque Game Builder · 03/02/2005 (5:31 am) · 3 replies
#2
Of course, setting this to false simply dismounts the object when its' parent object is destroyed, leaving it where it was last positioned.
Scenario:-
Objects D mounted to C mounted to B mounted to A. (all owned by mount).
Deleting A, deletes all objects ABCD.
Deleting B, deletes objects BCD.
Deleting C, deletes objects CD.
Deleting D, deletes D.
Assuming the same mount scenario above but non of the mounts are owned gives...
Deleting A, deletes A (dismounts B from A).
Deleting B, deletes B (dismounts C from B).
Deleting C, deletes C (dismounts D from C).
Deleting D, deletes D (does nothing else).
This system is very powerful as you can mount stuff and by default, not worry about anything other than the parent object. Stuff like gun-turrets, particle-effects, whatever can be mounted and forgot about which is very neat as stuff like this dominates the scene quite often and you don't want to be thinking about housekeeping all this hierarchical nonsense. That's the whole philosophy of T2D.
Hope this helps,
- Melv.
03/02/2005 (5:36 am)
@Robert: The choice is yours. When you mount, one of the parameters is called "ownedByMount?". This defaults to true. What this means is that if an object is destroyed, all of the objects that are mounted to it are also destroyed automatically as well as things that are mounted to their children, all the way down the chain. What this means is that if you have objects mounted on objects mounted on objects etc, and you destroy the parent object, all the objects are destroyed.Of course, setting this to false simply dismounts the object when its' parent object is destroyed, leaving it where it was last positioned.
Scenario:-
Objects D mounted to C mounted to B mounted to A. (all owned by mount).
Deleting A, deletes all objects ABCD.
Deleting B, deletes objects BCD.
Deleting C, deletes objects CD.
Deleting D, deletes D.
Assuming the same mount scenario above but non of the mounts are owned gives...
Deleting A, deletes A (dismounts B from A).
Deleting B, deletes B (dismounts C from B).
Deleting C, deletes C (dismounts D from C).
Deleting D, deletes D (does nothing else).
This system is very powerful as you can mount stuff and by default, not worry about anything other than the parent object. Stuff like gun-turrets, particle-effects, whatever can be mounted and forgot about which is very neat as stuff like this dominates the scene quite often and you don't want to be thinking about housekeeping all this hierarchical nonsense. That's the whole philosophy of T2D.
Hope this helps,
- Melv.
Torque Owner Jason McIntosh