Jump to content

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


photo

Recommended Posts

Posted

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?

Posted

engine.world.loadNode?

 

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

Posted

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
Posted
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?

Posted

No tutorial, but numerous samples. Please have a look into the script code snippets.

Posted

Killer.Penguin,

 

You can use setAnimation() to set animation from script.

 

Please, check Animation samples: <SDK folder>/data/samples/animation

Posted

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..

Posted

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?

Posted

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
 

Posted

Is there any doc on  unigine.h? I couldn't find it on your web...

Posted

You can find some information here.

 

upd. Full list of functions from unigine.h script you can find here

Posted

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.

Posted

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. :_)

×
×
  • Create New...