You only live twice but I can only mount once.
by Zilla · in Torque X 2D · 06/21/2008 (12:58 pm) · 3 replies
I mounted a particle effect to an object and everything works fine:
But the second time, this code is executed to mount this particle effect to another object, TorqueObjectDatabase.Instance.FindObject does not find this T2DSceneObject again and returns null.
What is missing?
T2DSceneObject particleEffect = TorqueObjectDatabase.Instance.FindObject<T2DSceneObject>("StardustParticles");
if (particleEffect != null)
particleEffect.Mount(myObject, "", true);But the second time, this code is executed to mount this particle effect to another object, TorqueObjectDatabase.Instance.FindObject does not find this T2DSceneObject again and returns null.
What is missing?
#2
Will
edit:Fixed spelling
06/22/2008 (8:10 am)
I think john may be right, if you are in fact deleting the first object maybe both get deleted. Have you tried setting owned by mount to false? ie:particleEffect.Mount(myObject, "", [b]false[/b]);
Will
edit:Fixed spelling
#3
@Will
I tried "false" first. Then the object will be deleted but the mounted particle effect will remain in the scene.
06/22/2008 (12:25 pm)
@JohnQuote:If the mounted object is deleted the particle effect may be deleted along with it.Shame, shame, shame, shame on me! Of course. Now my particle effect is a template and will be cloned each time I mount it (as you suggested). Thank you very much.
@Will
I tried "false" first. Then the object will be deleted but the mounted particle effect will remain in the scene.
Associate John Kanalakis
EnvyGames
John K.