[SOLVED] How do I spawn predefined character via UnigineScript?


photo

Recommended Posts

Ok so I have characters setup and all that from the editor. What function do I use to spawn them into my world via script?

Link to post

engine.world.loadNode?

 

After that how do I add the loaded node into the world?

Link to post

Hello,

The following line add your node to world but not to editor:

  Node node = engine.world.loadNode("<node_path>/node.node",0);

If you want to get access to the node from editor use engine.editor.addNode() function.

  • Like 1
Link to post
https://developer.unigine.com/en/docs/1.0/scripting/library/engine/engine.world#engine.world.loadNodes_string_int Nodeengine.world.loadNode (string filename,int cache)

"Loads a node from a file. If the node is loaded successfully, it does not belong to any node hierarchy or list, so be careful and make sure to handle it properly, when it is no longer needed."

 

Huh???

 

I'm very confused with Unigine along these loading and setting up character stuff. How do I add animations into it? Is there a good tutorial for this?

Link to post

Yeah, I looked at the character sample scriptss, but those seem really too complicated for my usage (as it uses animation tree, combiner and such.)

 

ObjectMeshSkin has setAnimation() and all that but it cannot saved nor do any animation blending on its own.

 

Wish we have something simpler that handle those simple tasks..

Link to post

ps. I notice these's this "node_load" function in character.h (mesh = node_load(mesh_file_name).)

 

However I couldn't locate the root of such function... can you help guide me to its root class?

Link to post

Killer.Penguin,

 

Animation samples shows how to combine animations using different layers.

To open animation samples enter "world_load samples" in console and choose animation/animation_00.

You can find source files for animation samples in <SDK folder>/data/samples/animation

You can find definition of node_load() function in unigine.h
 

Link to post

ps. I understand how the animation layer work, but I would very much like Unigine to have a simpler animation blending management built in. (For example, just call blend and such. No worrying about layers..) Just a nip-picking thought.

Link to post

Skinner and schemer is way too complicated for my need.. I just need simple animation system for blending and such,

 

Guess I have to come up with something simpler on my own. Thx though. :_)

Link to post