Hi there.
For sometime I've been trying to work out how to spawn a character within stingray. I'm using the basic project, therefore I don't have the player start gizmo in the create panel.
I've been told that it can be done by two nodes in the level flow, and I'm struggling to get this to work.
Can anyone help me out please?
Edit: Forgot to mention, I'm wanting to spawn the character when the project is launched, and also when a new level loads within the project.
Hi,
Refer this tutorial, http://help.autodesk.com/view/Stingray/ENU/?guid=__tutorial_link_tutorials_on_area_html. You will surely gain some important insights regarding spawning.
Thank you
If all you're trying to do is spawn a unit when the level is loaded, you can do it in the Level Flow.
Open up your level in the editor, and go to the Level Flow tab.
Start with the Level Loaded node. Add a Unit > Spawn Unit on Position. node. Then wire the Out event from Level Loaded into the Spawned input event on the Spawn Unit node. Set the Unit setting on the Spawn Unit node to the unit you want to spawn. Then set the initial position and rotation you want for the new unit, or leave the defaults to spawn at the center of the level.
If you're trying to work with the character from the character project, that's a little trickier because that character is set up and spawned in the character project's Lua code.
Thanks for that, that's helped me with something I wanted to do for another project. But I still don't know how to spawn the character.
Ah, I see.
That "character" unit is used only when you're in "walk" mode, which you enter by hitting F2.
By default, the camera is in a Fly mode. When you go to walk mode, the character is spawned and the camera is attached to the cylindrical character unit. That character unit is set up with a collision actor and a mover (which you can see if you go into the Unit Editor) so that as you move around the scene in walking mode, you can't walk through other physical objects like the box.
(The reason you don't see it while you're in walk mode is just that you're inside it, and its material is one-sided.)
The logic that sets up that spawning is all done in the script/lua/player.lua file, if you want to see how it works.
All that said, if you use the Flow that I pasted above, you should see the static cylinder unit get spawned in the middle of the level. However, that instance won't be hooked up to the movement controls in the player.lua script. It'll just be a static cylinder sitting there in the middle of the level.
Can't find what you're looking for? Ask the community or share your knowledge.