Arbitrary nodes on a mesh?
by Justin "Nitrogen" Larson · in Torque 3D Beginner · 03/27/2011 (5:17 pm) · 4 replies
Forgive me if this ends up being a really simple problem, but I'm rather new to Torque, and I haven't had any luck finding an answer.
What I'm wanting to do is have an in-game object of some sort, with arbitrary named nodes in the mesh (Most likely Collada, but if there's a better solution, let me know), and interact with these nodes in-game via TorqueScript. Creating weapons and vehicles, for example - Where do the projectiles come from on a gun? How do I attach the wheels to a vehicle? I know there's the existing weapons and vehicles in the FPS example, but I'm more interested in understanding how to do my own instead of just working within what's already there. There's more I'd like to use this for, too. Something I was thinking of doing with this was mounting two or more objects together, such as adding an attachment to a gun in a shooter, or adding a mounted turret to a point on a building as an upgrade in a strategy game. Randomly or procedurally distributing items by placing them at nodes in a building. For this kind of thing, I'd want to define my own nodes and be able to write script to put them to use.
If I missed something in the documentation that should have been obvious, I apologize. Any help would be greatly appreciated, be it a nice piece of example code, a tutorial somewhere, or even a hint as to where to find out for myself.
What I'm wanting to do is have an in-game object of some sort, with arbitrary named nodes in the mesh (Most likely Collada, but if there's a better solution, let me know), and interact with these nodes in-game via TorqueScript. Creating weapons and vehicles, for example - Where do the projectiles come from on a gun? How do I attach the wheels to a vehicle? I know there's the existing weapons and vehicles in the FPS example, but I'm more interested in understanding how to do my own instead of just working within what's already there. There's more I'd like to use this for, too. Something I was thinking of doing with this was mounting two or more objects together, such as adding an attachment to a gun in a shooter, or adding a mounted turret to a point on a building as an upgrade in a strategy game. Randomly or procedurally distributing items by placing them at nodes in a building. For this kind of thing, I'd want to define my own nodes and be able to write script to put them to use.
If I missed something in the documentation that should have been obvious, I apologize. Any help would be greatly appreciated, be it a nice piece of example code, a tutorial somewhere, or even a hint as to where to find out for myself.
About the author
Recent Threads
#2
Thanks for posting that tutorial, by the way. That will definitely be a lot of help.
04/02/2011 (4:00 pm)
Unfortunately, that's not quite what I'm looking for, but you did end up pointing me in what might be the right direction. What I was intending to do was not to use the existing special nodes, but define custom ones. Looking in the hits tab leads me to believe that I'll need to create a new shape type in order to do that. How would I go about doing that?Thanks for posting that tutorial, by the way. That will definitely be a lot of help.
#3
04/11/2011 (3:50 pm)
It all depends on the software you are using to create your models, but for instance if you happen to be using 3d studio these "nodes" you refer to are created with a helper object that has the correct naming convention that the engine identifies when you import. There does exist documentation on TDN on how to set up your models and what to name your "nodes" or helper objects for the engine to recognize them and utilize them, each type of shape type has its own set of nodes i.e shape types would be player, vehicle, etc.
#4
04/11/2011 (3:53 pm)
Refer to this document to assist in setting new models up for import with the correct nodes fosters.realmwarsgame.com/tools/DTS_Nodes.pdf
Torque 3D Owner Lunacy
To mount the weapon on a character, the character shape must have at least 1 mountNode : select "Player" under the "hints" tab after opening your character shape, and add the node in the nodes tree. Once it's done, you can mount the weapon by script, using the mountImage function. Download the .chm doc file here and check out the ShapeBase class page. Finally, even if it's not related, here is a tutorial that helped me a lot when I started. Hope this helps a bit.