manualObject as an entity?

randomCoder

28-11-2006 01:04:49

I used a manual object to create a simple cube outline, and i get crashes when i try to attach it to several different scene nodes. I assume i have to create new entities per sceneode iw ant to attach the manualObject to, but i cant figure out how. Any help?

rosenkro

28-11-2006 06:18:46

Try it like this:


Dim mObj As New ManualObject("terrainChunk-" & x & y)
mObj.Begin("Floor/Dirt-Grass")
mObj.Position(0,0,0)
mObj.TextureCoord(0,0)
mObj.Position(1,0,0)
mObj.TextureCoord(1,0)
mObj.Position(0,0,1)
mObj.TextureCoord(0,1)
mObj.Normal(0, 1.0F, 0)
mObj.Triangle(0,1,2)
mObj.End()

Dim sceneNode As SceneNode = sceneMgr.RootSceneNode.CreateChildSceneNode()
sceneNode.AttachObject(mObj)


It's VB.NET and creates a simple triangle.

Bekas

28-11-2006 08:48:19

Use
manualObj.ConvertToMesh("MeshName");
Entity ent1 = sceneMgr.CreateEntity("ManualEntity1", "MeshName");
Entity ent2 = sceneMgr.CreateEntity("ManualEntity2", "MeshName");