<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[GMan's Mods & Stuff — Removing Scene Nodes from an Array.]]></title>
		<link>https://gprogs.com/viewtopic.php?id=128</link>
		<atom:link href="https://gprogs.com/extern.php?action=feed&amp;tid=128&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Removing Scene Nodes from an Array..]]></description>
		<lastBuildDate>Mon, 27 Nov 2006 22:31:12 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Removing Scene Nodes from an Array.]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=535#p535</link>
			<description><![CDATA[<p>Thank you, that was the problem. Now it&#039;s working fine.<br />Thank you for the compliment. Wait till you see what I&#039;m working on.<br />Keep up the great work on the mods. Bye</p>]]></description>
			<author><![CDATA[null@example.com (HondaDirtBiker)]]></author>
			<pubDate>Mon, 27 Nov 2006 22:31:12 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=535#p535</guid>
		</item>
		<item>
			<title><![CDATA[Re: Removing Scene Nodes from an Array.]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=534#p534</link>
			<description><![CDATA[<p>greetings <img src="https://gprogs.com/img/smilies/smile.png" width="15" height="15" alt="smile" />&nbsp; the only thing that raises a flag in my mind is the erase() call inside the loop.&nbsp; this will resize the array during the loop and cause skipping of nodes.&nbsp; for example, if i was on node 1 and then erased it, node 2 is now node 1 but my next index is 2.&nbsp; old node 2 is now completely skipped.&nbsp; i would try building a TList or array to queue up the erase calls and then call them after the main for loop.&nbsp; the second loop would essentially call the erase() in descending order.&nbsp; an alternative is store the size and loop backwards in your for loop using the stored size instead of the Size() call.&nbsp; </p><p>also, are you rebuilding the array coming back into this code or is the AsteroidNode array persistant?&nbsp; if for some reason Irrlicht decides to remove one of the other scenenodes in the array that could cause this error also.</p><p>on a side note, i have long thought about a simple try/catch that would improve the IsValid() functionality.&nbsp; i may see if there is something i can do about that in the next version.&nbsp; the reason i have not yet done it is most of the time the crashes are telling you something.&nbsp; not sure if i want to eliminate that or not.</p><p>EDIT: i checked out the SpacePirate screenies.&nbsp; looking good <img src="https://gprogs.com/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></description>
			<author><![CDATA[null@example.com (gman)]]></author>
			<pubDate>Mon, 27 Nov 2006 12:48:15 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=534#p534</guid>
		</item>
		<item>
			<title><![CDATA[Removing Scene Nodes from an Array.]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=533#p533</link>
			<description><![CDATA[<p>I need to create scenenodes in an array, find information about each element, then delete certain scenenodes within the array.<br />I wrote this code to delete certain nodes but after I delete some nodes then run the function again I receive an error saying &quot;unhandled memory exception, cannot getposition()&quot;<br /></p><div class="codebox"><pre><code>&#039;Delete Asteroid
Local PlayerPos:Vector3df = PlayerNode.getPosition() &#039;Position of Player

If (AsteroidNode.Size() &gt; 0)
    Local Ast:Int &#039;Current Array Element
    
    For Ast = 0 To AsteroidNode.Size() - 1
        Local AstNode:ISceneNode = AsteroidNode.elementAt(Ast) &#039;Current Asteroid Node
        
        If (AstNode.isValid() = True)
            If (AstNode.getPosition().getDistanceFrom(PlayerPos) &gt; Radius And AstNode.getName() &gt;&lt; &quot;Cave&quot;)
                AstNode.Remove()
                AsteroidNode.erase(Ast)
            End If
        End If
    Next
End If</code></pre></div><p>I could be removing the scenenodes incorrectly but, If I don&#039;t remove the scenenode before the element, the scenenode is not removed.</p>]]></description>
			<author><![CDATA[null@example.com (HondaDirtBiker)]]></author>
			<pubDate>Fri, 24 Nov 2006 20:23:17 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=533#p533</guid>
		</item>
	</channel>
</rss>
