Game Development Community

Mounting Object on StaticShapeData (Torque 3D 1.2)

by Allan Bregas Sentausa · in Torque 3D Professional · 07/12/2012 (8:41 pm) · 11 replies

Hello all,

I tried to mount an object (dts/dae) to Static Shape data on Shape Editor. It has been mounted when I see it on shape editor, but when I close an reopen World Editor again, it dissapear. I dont know if it's a bug or not, but is there any code to mounting object to another object? I'm a newbie on Torque 3D and I dont see any clue when I search on forum/documentation. :(

#1
07/17/2012 (5:58 pm)
I am currently working on this myself as I need to mount physx cloth, sails, to a ship. I am having massive issues trying to make the StaticShapedata object to have collision (this is a stupid problem to have now a days I know), but I will lay this issue to rest and see if I can get the mount to work and give you a run down on how it works if successful.
#2
07/17/2012 (7:43 pm)
@DreamPharaoh: hell yeah, for a while I just create dummy box (TSStatic) that wrap my object (StaticShape) to have collision on it. Hope it will fix soon. Thank you for your response...
#3
07/17/2012 (8:12 pm)
The idea you have on the collision meshes is an idea that made me cringe not because it is a bad idea but that this is a stupid problem to have even since the late 90's, this an issue with the engine and not you.
I am sorry that no one responded to you sooner. I will be back on Thursday to tackle this issue again and will give you an update. Please remind me if I somehow forget to communicate back.

#4
07/17/2012 (8:44 pm)
The documentation has a section called "Artist Guide." Within it you will find the "Primer" section, which has a page called "Torque Art Primer." This covers the basics of getting objects into Torque.

I think your mounting problem stems from not having a "mountPoint" dummy node on the object you want to mount and a "mount0" node on the object you want to mount it to. Also, TSStatics can use the visibleMesh collision mode - look in the property page in the editor under Collision.
#5
07/17/2012 (10:01 pm)
Documentation guide: I've looked at that many times...


.. and I will let you know HOW IT REALLY WORKS from an actual example on Thursday, late Thursday, from my experience with this engine at best.

I want to be proven wrong on this.

EDITED: I have deleted issues regarding Torque so as to allow the community to chime in prior to what needs to be said. The portion deleted has been saved and will be posted again outside of this site if necessary.

The original bet is still up:

I bet that the entire community of Torque will not help, or will not be able to help Allan by 07/19/12 at 12:00AM (Eastern time) supported by a comment from Allan himself, if he chooses.
#6
07/17/2012 (10:15 pm)
Hmm, last time I checked the soldier can mount a weapon. Perhaps studying this pair of models (the soldier and the lurker rifle) can help to show with an actual, working example, how it should be done.
#7
07/17/2012 (10:55 pm)
@Richard. I have always looked through the documentation and then through the forums and found your help... thank you on that. In regards to the weapon example: this does not help. You have weaponimagedata and the difference between first person and second person data, and mega-tons of crap-datablocks describing particles alone.

How does this help some one new?

To answer: Regardless of what you think or about to say... It doesn't -- this is the disconnect.

No one would understand how to look through a weapon.cs file and even remotely understand it, period.

No one would understand what is created specifically for the weapon itself and what is engine code outside of what is specific to the weapon without trial and error. How do you describe how to create the animation for the weapon, and how to spit out a "torque ready form" for the engine, unless you plan on using the stock weapons.

What you are stating is a mere shadow to what is required. There are numerous incomplete posts on getting the stupid TSShapeConstructer to create a simple collision mesh alone... what? We have a problem creating a collision mesh?

Hmm, the last I checked the difference between a player object mounting and a common object mounting is night and day, just saying.


#8
07/17/2012 (10:58 pm)
Take your first object to be mounted to, and have a datablock (Item, StaticShape, Vehicle, Player, etc) for it. You will also need a datablock for the object that will do the mounting (Item, Image, StaticShape, Vehicle, Player, etc). Within the onAdd() callback (in script) for the first object include the command to mount the second object. Look at how the Cheetah, for example, mounts the various lights and turret to it.
#9
07/19/2012 (1:39 pm)
Ok, this is what I have so far. I will use what I have as the example: I have made some sails and an Airship. The Airship is the main object and so I put some empties in the model using Blender and named them mount0 and mount1 (you only need mount0 in this case). In the sails object file I put an empty and named it mountPoint. I made a datablock for each object with some simple mounting code.
-----------------datablocks with code------------------

datablock StaticShapeData(AirshipSails)
{
shapeFile = "art/shapes/SolVynthryn/FloatingBridge.dae";
category = "Ulanji_Vehicle";
className = "AirshipSails";
};

datablock StaticShapeData(AirShip)
{
shapeFile = "art/shapes/Airships/UlanjiAirship.dae";
category = "Ulanji_Vehicle";
className = "Airship";
mountPoint = 0;
};
function AirShip::onAdd(%this, %obj)
{
echo("CREATING AIRSHIP CAPTAIN");
%obj.mountObject(EnergySails, %this.mountPoint);
}
----------------------------------
I added the sails in first and named them EnergySails. Then when adding the Airship model they mount instantly at the locations where the empties where set up in Blender.
I hope this helps, and feel free to ask any questions. The next step will be to make the script do this when needed during the game. In this case they will form and then go away with a raycast from the player.

#10
07/30/2012 (6:45 pm)
well, thank you for your responses, For a week I didn't check in my thread because our job. I'll try DreamParaoh suggestion and it work well. Haha, I set and get each object position earlier week but it will solve my problem... -,-a
#11
07/30/2012 (7:12 pm)
@Allan: I am glad it helped. I have been doing classes and have not had anytime to develop this further. I would really like to make this into a tutorial of sorts with varying levels of complexity.

@Richard: I was looking through my comments above and I apologize for coming across like that -- I rarely know what I am talking about half the time, just ask anyone I know. Anyways, thank you for helping on many tough issues in the past.

Take Care