fxLightBD attached to buggy light?
by Martin Schultz · in Torque Game Engine · 11/03/2002 (12:10 pm) · 7 replies
Hi,
I've seen once that melv attached a fxLightDB to the buggy's front lights. I've searched already through the forums but didn't find a precise answer.
So, I'm currently able to mount the fxlight to the car itself, but then positioning doesn't work. My favorite would be to attach the light directly to a mount point. Does anybody knows how? Script example?
right now it looks like this:
function WheeledVehicleData::onAdd(%this,%obj)
{
.
.
.
// create the car lights
%obj.getDataBlock().fxldb1 = new(fxLightDB)()
{
dataBlock = fxDefaultLight;
};
%obj.getDataBlock().fxldb1.attachToObject(%obj);
MissionCleanup.add(%obj.getDataBlock().fxldb1);
where fxldb1 is a variable in my vehicle datablock.
Any clues? :-)
Best,
Martin
I've seen once that melv attached a fxLightDB to the buggy's front lights. I've searched already through the forums but didn't find a precise answer.
So, I'm currently able to mount the fxlight to the car itself, but then positioning doesn't work. My favorite would be to attach the light directly to a mount point. Does anybody knows how? Script example?
right now it looks like this:
function WheeledVehicleData::onAdd(%this,%obj)
{
.
.
.
// create the car lights
%obj.getDataBlock().fxldb1 = new(fxLightDB)()
{
dataBlock = fxDefaultLight;
};
%obj.getDataBlock().fxldb1.attachToObject(%obj);
MissionCleanup.add(%obj.getDataBlock().fxldb1);
where fxldb1 is a variable in my vehicle datablock.
Any clues? :-)
Best,
Martin
#2
11/03/2002 (2:03 pm)
Maybe you could use some dummy (invisible) DTS shape (as an Item or something), then attach the light to it, and mount that dummy object (with the light) to the node on the car... makes sense? :?
#3
Daniel: I tried that:
%vehicle.mountObject(%lightobj,%node);
It didn't work out. The resulting object is a "0" so it seems it can't mount the light that way.
Stefan: That's a point - I'll try this.
Is there a way to actually get a mount point as object I've seen some script functions for that, but I got always an error back when trying to mount a light to the resulting object.
Any other clues? :-)
Best,
Martin
11/04/2002 (9:21 am)
Hi,Daniel: I tried that:
%vehicle.mountObject(%lightobj,%node);
It didn't work out. The resulting object is a "0" so it seems it can't mount the light that way.
Stefan: That's a point - I'll try this.
Is there a way to actually get a mount point as object I've seen some script functions for that, but I got always an error back when trying to mount a light to the resulting object.
Any other clues? :-)
Best,
Martin
#4
02/09/2003 (3:25 am)
The fxLightDB is a GameBase object not a ShapeBase object thus it couldnt be mounted like an image or shape to a node. Sadly when it comes to the engine I'm just plain dumb. I could script a headlight setup but it wouldnt be as easy as one of you smart fellas adding the support for node attachment.
#5
I attached the light by modifying the engine slightly. It's not that difficult to do but it is a little technical. You can't do it efficiently in scripts without modifying the engine.
All I did was to modify an object that can be attached by embedding the fxLight class within it.
Sorry I've not go the code to show you this but it ain't that difficult to do.
- Melv.
02/09/2003 (3:34 am)
Guys,I attached the light by modifying the engine slightly. It's not that difficult to do but it is a little technical. You can't do it efficiently in scripts without modifying the engine.
All I did was to modify an object that can be attached by embedding the fxLight class within it.
Sorry I've not go the code to show you this but it ain't that difficult to do.
- Melv.
#6
Sam
02/11/2003 (1:49 am)
So your saying it can be attached to a node within the shape file? Once modified of course.Sam
#7
In a manner of speaking, what I'm saying is that yes, custom objects such as this one requires C++ changes to mount. Tagging it onto existing mounting code can also be a nice shortcut, if not always efficient.
For general mounting of objects, it would be good to create a facility to mount any SceneObject; that way any object based upon this could be mounted, shape or not.
- Melv.
02/12/2003 (3:15 am)
Sam,In a manner of speaking, what I'm saying is that yes, custom objects such as this one requires C++ changes to mount. Tagging it onto existing mounting code can also be a nice shortcut, if not always efficient.
For general mounting of objects, it would be good to create a facility to mount any SceneObject; that way any object based upon this could be mounted, shape or not.
- Melv.
Torque Owner Daniel Neilsen
ie.
%vehicle.mountObject(%lightobj,%node);
That may work, not sure though