How do I add 2 objects at one time in the world creator?
by Tom Bentz · in Torque Game Engine · 11/30/2005 (11:12 am) · 6 replies
I'm trying to add 2 objects at the same time. Say a door, and a separate collision mesh (separate so I can move the collision mesh when the door opens). Is this possible to add both objects though script/world creator?
#2
11/30/2005 (1:56 pm)
Thank Chris - but what I would like to do is add both at the same time by clicking on the door object - I dont want to add a door, then the collision mesh. I would like the collision mesh to be automatically added and positioned when I add the door. Is that at all possible?
#3
11/30/2005 (3:27 pm)
Why not add a collision mesh to the door in the modelling program used to create it?
#4
I guess there's no way to add 2 objects with one click in the world creator then?
11/30/2005 (4:17 pm)
The collision mesh cant be animated in the same way as the door, it needs to be a separate object (and moved separately) in order for the the door to allow passing through. I guess there's no way to add 2 objects with one click in the world creator then?
#5
Ok, so I just looked over my stuff, and what you need is a create method in your datablock class. So I had a CrusherData datablock, and I defined:
I've noticed that if you try to position objects, they will be overwritten by the editor, so you need to make a schedule for the objects to set position. In my case, I schedule for 250ms, but you could do it even sooner. In my case I got the transform for the original object, then positioned all secondary objects based on the original.
So in this create function, you need to create other objects, as well as the original object.
Here is the first object.
And here is another object (I was creating about 5 objects per machine)
Good luck!
11/30/2005 (9:17 pm)
Sure there is a way, but you have to get your hands a little dirty with scripting. I did this over a year ago for a game which I abandoned after I realized the prototype just stunk. Ok, so I just looked over my stuff, and what you need is a create method in your datablock class. So I had a CrusherData datablock, and I defined:
function CrusherData::create(%data) {%data is the datablock which the editor passes in.I've noticed that if you try to position objects, they will be overwritten by the editor, so you need to make a schedule for the objects to set position. In my case, I schedule for 250ms, but you could do it even sooner. In my case I got the transform for the original object, then positioned all secondary objects based on the original.
So in this create function, you need to create other objects, as well as the original object.
Here is the first object.
%objname = "CrusherNum" @ $Machines::NameCount;
%obj = new StaticShape(%objname) {
dataBlock = %data;
...And here is another object (I was creating about 5 objects per machine)
%depname = "DepositNum" @ $Machines::NameCount;
%dep = new StaticShape(%depname) {
datablock = "DepositData";
depositObject = true;
acceptType = "BlackRockProjectile";
};Good luck!
#6
11/30/2005 (10:07 pm)
Thanks J. Alan! Thats what I was looking for, checking it out now...
Torque Owner Chris Labombard
Premium Preferred