Stingray Forum (Read Only)
Welcome to Autodesk’s Stingray Forums. Share your knowledge, ask questions, and explore popular Stingray topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Units, Entities, SceneGraphs & Parenting

6 REPLIES 6
Reply
Message 1 of 7
Anonymous
1205 Views, 6 Replies

Units, Entities, SceneGraphs & Parenting

Hi everyone.

 

I've been trying to figure out what a few different elements are in Stingray, but am having trouble understanding with the documentation alone. In particular, entities and scene graphs.

 

I understand that a unit is any game object whether it be a camera, a mesh etc.. however, say if I wanted to create an object that consisted of interchangeable meshs, which had their own animations which I wanted to be able to control individually, for example a ship that you could customize by purchasing new weapons, I'd need to be able to swap out the weapons for new meshes which would have their own unique animations that could be triggered individually when they fire a shell. Is this possible by having all the meshes in the one unit, and then being able to customize and control that unit dynamically? Or do I need to create some other type of object which all my individual units are parented to (i.e the main body of the ship is one unit, then all the turrets are separate units)?

 

I was looking at the Entity object and SceneGraph as well.. however the documentation for an Entity is: "Opaque object representing an entity." Since I don't know what it is, when it uses it's own name to describe itself it's rather confusing haha. (So it would be great if the documentation on that could be expanded) and also the SceneGraph looks promising but it's documentation is a little on the light side too. I saw in the Appkit there is a unit_link script which looks promising, but without knowing the above information it's hard to determine how it works. If a description on how the unit_link works could be provided that would also be amazing, and some information on what entities and scenegraphs are. Thank you!

 

Cheers,

Kaine

6 REPLIES 6
Message 2 of 7
Anonymous
in reply to: Anonymous

Thought I should add I'm asking everything in regard to Lua.

 

Thanks!

Message 3 of 7
paulkind
in reply to: Anonymous

hello.  ok, so to answer at least one part of your question you will want to use visibility groups. 

 

here is how i would solve the problem of your starship with different loadouts.

 

1 model the starship and all of its parts.  save and export with the animations.

2 import the the starship and toggle the animations checkbox so all of its animations and skeletal rigs are imported.

3 open the model in the unit editor.

4 in the unit editor, open up the visibility groups tab.  assign as needed.

5 use either flow or lua to enable and disable the visibility groups.  in flow you will use the node "set visibility group" to enable the visibility groups as needed.  please note, visibility groups are independant of eachother so you could enable ship main, weapon one, weapon two, etc.  therefore you will need to set them individually.  ie: enable weapon one, enable weapon two and disable will work the same way. 

6 use flow or lua to start/stop the animations. in flow the node needed is "animation clip reset and play".

 

hopefully this explains well enough to get you started.

 

paul

 

Areas of Expertise - MayaLT : Mudbox : 3DS Max : Inventor : Game Dev
Follow me on Twitter : @paulkind3d

Please remember to give kudos freely and mark acceptable answers as solved!

PLEASE do not send me private messages unless asked to do so. If you have a question, start a thread, and ask me on the public forums where answering your question may help others.

Did you know there was a YouTube learning channel for Autodesk Games? New videos are posted regularly with all sorts of content relative to Stingray, Maya/MayaLT, 3DS Max, and other game related tools. Get your game on @ https://www.youtube.com/user/autodeskgameshowtos
Message 4 of 7
Anonymous
in reply to: paulkind

Hey mate,

 

So that would let me trigger individual animations for guns etc without affecting the other animations that are running on the ship?

 

Thanks for the reply!

 

Cheers,

Kaine

Message 5 of 7
dan.matlack
in reply to: Anonymous

As long as your anim controller is set up properly or the animations are simple and not meant to blend together, you should have no issues there.
______________________________________
Dan Matlack
Senior Content Manager || Games Solutions
Autodesk, Inc.
Message 6 of 7
Anonymous
in reply to: dan.matlack

Cool, thanks Dan. I'll check it out. However pretty sure my PC just had a fatal error is completely fried about 2 minutes ago so I won't be checking out yet!

 

Also, I was wondering if you were able to maybe find someone who could answer my other questions? I can't find the answers in the documentation so probably only one of you experts from Autodesk can find the answer hehe. Sorry! I know you're all busy!

 

Cheers,

Kaine

Message 7 of 7
dan.matlack
in reply to: Anonymous

Currently, our "basic object" is a unit. That .unit file will contain all the info about that unit including physics, animations, mesh data, etc ... The entity system, which currently consists of the terrain and the environment, will have a scene graph make up ( a basic node hierarchy ), that will hold all the components of that entity. Moving forward, we will be iterating on the entity system and how that works with a component library of sorts. That would mean you could have an entity, like a space ship, and have multiple components ( turrents, weapons, wings, engines ) inside of it that you could control via flow or scripting.

 

You can currently do this in flow or lua as well. For you space ship and its components, there are many ways you can handle that from a pipeline point of view. It may make more sense for you to have all your mesh parts in one unit and hide or show based on user choices, or it may make more sense to have one unit that you link the appropriate items to when the user wants. Currently to do that, you would use unit link in lua scripting.

 

Here is an example from the character template in player.lua of unit link usage (this is for spawning the player weapon and linking to the character):

 

 


local UnitLink = require 'core/appkit/lua/unit_link' local function spawn_player_weapon(self, pose) local weap_unit = World.spawn_unit(SimpleProject.world, "content/models/weapon/weapon", pose) local player_weapon = self.player_weapon player_weapon.unit = weap_unit local unit_link = UnitLink(player_weapon, SimpleProject.level, weap_unit, 1, nil, 1, false) return weap_unit
end

Here is another example from same file in enable_walk_mode(self)

 

	-- attach camera to character
	local land_unit = self.land_character.unit
	local unit_link = UnitLink.manager:get(player_camera)
	unit_link:set_parent(land_unit, 1)
	unit_link:link()

	-- add character weapon
	spawn_player_weapon(self, pose)
	local unit_link_weap = UnitLink.manager:get(self.player_weapon)	
	unit_link_weap:set_parent(land_unit, Unit.node(land_unit, "s_genrig_RightHandAttach"))
	unit_link_weap:link()

You can link and unlink units at will during gameplay. That would be one way to do what you'd like. Or you can hide and show meshes by node in the unit if you put all your meshes into one unit. 

 

______________________________________
Dan Matlack
Senior Content Manager || Games Solutions
Autodesk, Inc.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report