Jump to content

Невозможно "удалить" лисичек в "Creating and Removing Nodes Via Code"


photo

Recommended Posts

Posted

Добрый вечер!

https://developer.unigine.com/en/learn/2.21/06_implementing_app_logic/4_4?implementationLanguage=cs&precision=f

В примере кода ObjectPlacer.cs:

if (meshAsset.IsFileExist && (spawnPoints2 != null))
{
	// place in every point marked by child nodes of the specified list (Spawn-points)
	for(int i = 0; i < spawnPoints2.NumChildren; i++)
	{
		// create the Static Mesh node using the specified *.mesh asset and set the specified material for it
		ObjectMeshStatic mesh = new ObjectMeshStatic(meshAsset.Path);
		mesh.Name = "generated_mesh_" + i.ToString();
		mesh.SetMaterial(meshMat ,"*");
		mesh.WorldTransform = spawnPoints2.GetChild(i).WorldTransform;
		// add the Removable component to the node, that allows us to delete a node by right-clicking
		mesh.AddComponent<Removable>();
	}
}

По всей видимости необходимо добавить еще:
 

mesh.SetIntersection(true, 0);

Не знаю, на сколько правильно исправил (сегодня первый день изучаю), но после включения я смог взаимодействовать с лисичками (удалять их).

Возможно я пропустил что-то?..

Posted

Здравствуйте, @shaman2010!
Действительно, в C# пропущена эта строчка (в C++ коде она есть), приносим извинения за неудобства!
Исправления внесены, документация обновлена!
Спасибо за замечание!

  • Like 1
×
×
  • Create New...