Killer.Penguin Posted January 29, 2014 Share Posted January 29, 2014 I'm totally confused now. I have a smesh file in "data/path/file.smesh" folder. How exactly do I add it into the via UnigineScript? I tried using: ObjectMeshSkinned nMesh = engine.editor.addNode("data/path/file.smesh"); but it said that it cannot convert pointer to Mesh. So I tried using a *ptr but it keeps reporting that it doesn't understand '*'. So Then I tried: ObjectMeshSkinned nMesh = new ObjectMeshSkinned ("data/path/file.smesh", 0); It compiled but that doesn't seem to do anything. I don't see any new mesh both in world window and editor window. Totally stuck now. Much appreciate for any help I can have with this. best, T_T (ps. I cannot believe you do not have any tutorial for adding mesh object through the script though.. I mean, wouldn't this be a good place to start your programming guide?) Link to comment
ulf.schroeter Posted January 29, 2014 Share Posted January 29, 2014 As already stated in other thread: there is a simple example for ObjectSkinnedMesh including the required code for smesh file loading. If you don't want to invest this time for getting started, I don't think that other users of the forum are willing to invest their time on helping you Link to comment
Killer.Penguin Posted January 29, 2014 Author Share Posted January 29, 2014 I've spending the whole day digging through samples to locate it actually. But it's very hard to look for something you don't know even where to start looking. I've found and tried all things I could find in samples (as asked in my previous post) but I'm at my wit's end. This is like you telling me to go learn french from a french book. To the native, it must be hard to understand why other couldn't figure it out. But as a customer in trouble, I'm telling you that it's very hard without all these basic coding tutorials.So can someone kindly point me to the right explanation? T_T Link to comment
sebastianbah Posted January 29, 2014 Share Posted January 29, 2014 Hello Killer.Penguin,You can try to do it this way: ObjectMeshSkinned nMesh = engine.editor.addNode(node_remove(new ObjectMeshSkinned("data/path/file.smesh"))); But keep in mind that the new object has no material assigned. Link to comment
Killer.Penguin Posted January 29, 2014 Author Share Posted January 29, 2014 Oooh I think I might have tried something along that line but it didn't work... I'll go try it again and let you know tomorrow. Thx :) ps. so we just keep using engine.editor class for all node adding? Is there any bad side effect to it? Link to comment
Killer.Penguin Posted January 29, 2014 Author Share Posted January 29, 2014 Ok, it worked.The mesh is added into the world but not visible. So I must have thought it failed or so... :blink: Link to comment
Killer.Penguin Posted January 29, 2014 Author Share Posted January 29, 2014 Back to pointer issue... Unlike "engine.world.loadNode()" which directly ask for a file name, "engine.editor.addNode()" ask for a Node Class instead. So, how exactly do I use "engine.editor.addNode()" to add a "<path>file.node" to the world? Currently I'm using: Node nNode = engine.world.loadNode("<path>filename.node"); engine.editor.addNode(nNode); Which seems to work, but I would suspect that it's redundantly wrong somehow. Link to comment
sebastianbah Posted February 3, 2014 Share Posted February 3, 2014 Hello,There shouldn't be any problems if you use te following for adding node from the script: Node nNode = engine.world.loadNode("<path>filename.node"); engine.editor.addNode(nNode); In this case node is handled by editor script. If you still have any problems with visibility, please, check the material assigned to the node. Link to comment
Killer.Penguin Posted February 3, 2014 Author Share Posted February 3, 2014 We got our character loading working well now. thx a lot. :) Link to comment
Recommended Posts