<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Retrieving particle positions for Multi-Instance]]></title><description><![CDATA[<p dir="auto">Hello.</p>
<p dir="auto">I need to retrieve the particle positions from the object used in INSTANCEOBJECT_MULTIPOSITIONINPUT parameter of Multi-Instance.</p>
<p dir="auto">The documentation says it supports Mograph Matrix, Emitter and Thinking Particles.<br />
I retrieve the positions from Mograph Matrix using ID_MOTAGDATA tag.</p>
<p dir="auto">How can I do the same with Emitter and Thinking Particles ?</p>
<p dir="auto">Thank you for your time !</p>
]]></description><link>http://developers.maxon.net/forum/topic/11738/retrieving-particle-positions-for-multi-instance</link><generator>RSS for Node</generator><lastBuildDate>Tue, 06 Oct 2026 18:52:33 GMT</lastBuildDate><atom:link href="http://developers.maxon.net/forum/topic/11738.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 22 Aug 2019 08:04:33 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Retrieving particle positions for Multi-Instance on Mon, 26 Aug 2019 07:47:26 GMT]]></title><description><![CDATA[<p dir="auto">Thank you for your help !</p>
]]></description><link>http://developers.maxon.net/forum/post/59129</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/59129</guid><dc:creator><![CDATA[peterakos]]></dc:creator><pubDate>Mon, 26 Aug 2019 07:47:26 GMT</pubDate></item><item><title><![CDATA[Reply to Retrieving particle positions for Multi-Instance on Thu, 22 Aug 2019 09:30:10 GMT]]></title><description><![CDATA[<p dir="auto">hello,</p>
<p dir="auto">so you want to retrieve the positions of particles (from particles object or TP) ?</p>
<p dir="auto">About Thinking Particles you have information <a href="https://developers.maxon.net/docs/cpp/2023_2/page_overview_thinkingparticles.html" target="_blank" rel="noopener noreferrer nofollow ugc">here</a>, <strong>don't forget</strong> to use <a href="https://developers.maxon.net/docs/cpp/2023_2/c4d__particles_8h.html#a891e1426238f68418ce0789b06f4381e" target="_blank" rel="noopener noreferrer nofollow ugc">InitThinkingParticles</a> before using it.</p>
<p dir="auto">For Particles Object you have <a href="https://developers.maxon.net/docs/cpp/2023_2/class_particle_object.html#a3fd3d9e12e47fc25f838ea9a3f4257ee" target="_blank" rel="noopener noreferrer nofollow ugc">this page</a> and this is pretty straight forward.</p>
<p dir="auto">For example :</p>
<pre><code>        // Retrieves Particles Object

	BaseObject *selObj = doc-&gt;GetActiveObject();
	
	
	if (selObj == nullptr || !selObj-&gt;IsInstanceOf(Oparticle))
	{
		MessageDialog("Need to select a particle object"_s);
		return maxon::OK;
	}


	// cast object to ParticleObject
	ParticleObject* partObj = static_cast&lt;ParticleObject*&gt;(selObj);
	if (partObj == nullptr)
		return maxon::NullptrError(MAXON_SOURCE_LOCATION);

	const maxon::Int32 cnt = partObj-&gt;GetParticleCount();

	// Retrieves the particle tag that is invisible.
	ParticleTag* partTag = static_cast&lt;ParticleTag*&gt;(partObj-&gt;GetTag(Tparticle));

	for (maxon::Int32 i = 0; i &lt; cnt; i++)
	{
		const Particle* myParticle = partObj-&gt;GetParticleR(partTag, i );
		// Check particle's age before output position
		if (myParticle-&gt;t &gt; 0)
			DiagnosticOutput("particle position @ have age @", myParticle-&gt;off, myParticle-&gt;t);
	}


	
	// Creates particles in TP

	// Retrieves the TP Master
	BaseSceneHook* hook = doc-&gt;FindSceneHook(ID_THINKINGPARTICLES);
	if (hook == nullptr || hook-&gt;GetType() != ID_THINKINGPARTICLES)
		return maxon::NullptrError(MAXON_SOURCE_LOCATION);

	TP_MasterSystem* tpmaster = static_cast&lt;TP_MasterSystem*&gt;(hook);

	if (tpmaster == nullptr)
		return maxon::NullptrError(MAXON_SOURCE_LOCATION);

	// Alloc 10 particles 
	maxon::Int32 ids[10];

	if (tpmaster-&gt;AllocParticles(10, ids) == NOTOK)
		return maxon::OutOfMemoryError(MAXON_SOURCE_LOCATION);

	// Changes position of particles and retrieves it to output it.
	for (auto pid : ids)
	{
		tpmaster-&gt;SetPosition(pid, Vector(pid * 50));
		Vector pos = tpmaster-&gt;Position(pid);
		DiagnosticOutput("position of particle @ is @", pid, pos);
	}


	EventAdd();
</code></pre>
<p dir="auto">Cheers,<br />
Manuel</p>
]]></description><link>http://developers.maxon.net/forum/post/59088</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/59088</guid><dc:creator><![CDATA[Manuel]]></dc:creator><pubDate>Thu, 22 Aug 2019 09:30:10 GMT</pubDate></item></channel></rss>