Object to lamp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2009-09-18 07:59 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2009-09-18 08:09 PM
Wrathchild wrote:Open the object and change its subtype to "Light" (US library) as seen in the attached screenshot.
If I have a regular object I made or downloaded, how can I save it as a lamp object?
Then...

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2009-09-18 08:12 PM
Note that these new parameters will not do anything though unless you modify the GDL code to include a lamp to emit light, tied to those parameters.
In the screenshot, I've turned a bean-bag chair into a lamp object, but it is still just a bean-bag chair.
Easiest thing for the GDL code is to just copy a snippet from an existing lamp object in the library. Getting the lamp aimed in the right direction could be the most challenging part.
Cheers,
Karl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2009-09-18 08:24 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2009-09-18 09:02 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2009-09-18 09:12 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2009-09-18 09:44 PM
The light sphere is located at the bottom of my light fixture. I would like it to be in the middle.
I copied the script from a general light which has a parameter of slc for the showing the light sphere.
Do one of these numbers control where the light sphere is located?
If slc Then
For i=1 To 4
hotspot 0,0,0,unID,dist1,1+128 : unID=unID+1
hotspot 0,-1,0,unID,dist1,3 : unID=unID+1
hotspot 0,dist1,0,unID,dist1,2 : unID=unID+1
hotspot 0,0,0,unID,dist2,1+128 : unID=unID+1
hotspot 0,-1,0,unID,dist2,3 : unID=unID+1
hotspot 0,dist2,0,unID,dist2,2 : unID=unID+1
rotz 90

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2009-09-19 02:25 PM
The code you posted is for some editable (movable) hotspots, which might be used for allowing the user to move the light in the model, controlling the parameters dist1 and dist2. The light would need to be transformed (moved) by these same parameters in the 3D Script, or the light could be moved without them if you don't need this feature. In short, the light needs to be transformed (moved) within the 3D Script, usually with the ADD transformation, like any other part of the 3D model. Also, you have shown only part of this subroutine, as the FOR needs a NEXT to complete the loop, so there may be other things going on in this part of the script.
David
www.davidmaudlin.com
Digital Architecture
AC28 USA • Mac mini M4 Pro OSX15 | 64 gb ram • MacBook Pro M3 Pro | 36 gb ram OSX14
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2009-09-19 08:10 PM
Here is the object. I found a line in the master script: j=slc
I thought that might be what I needed to work on with ADD and tried a couple things but nothing happened.
Would you mind taking a look and letting me know if this is indeed what I should be looking at and where to put the ADD.
Any help would be much appreciated as I'm still not very fluent with GDL and pretty much just muddle along.
Rick

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2009-09-20 06:16 PM
[For those who have not looked at his object, it is a .3ds file converted to a .gsm file. The 3D Script with the lantern part is about 2600 lines of code, in addition to the lamp code Rick added, which is about 100 lines of code.]
You should treat the code you added as one block or subroutine, add a transformation at the beginning of the code to move the lamp to the desired location within the lantern, then delete that transformation at the end of that code before the lantern code. This is similar to selecting one element within your model and moving it relative to the other parts.
So on this case, the start of the code should be:
…If C And G Then
AddZ zzyzx*.5 ! move light vertically 1/2 the height of the object
DIM colorRGB[3]
colorRGB[1] = D
colorRGB[2] = E
colorRGB[3] = F…
AddZ moves the local origin in the vertical direction, zzyzx is the height of the object (you can see this parameter in the library part main window), multiplying this by .5 moves the local origin 1/2 the height of the object.
And the end of the lamp code should be:
…sphere dist2
model solid
EndIf
Del 1 ! delete transformation
MUL A/0.2048950, B/0.2048979, zzyzx/0.7640000…
The Del removes the last transformation, in this case your AddZ command, so the local origin is returned to its original location for the rest of the lantern code from the .3ds file.
As for the sic and other parameters, you can look at the main library part window under the Variable column, and read their description in the Name column so you know what they do. In this case the sic parameter is for controlling the Show Light Sphere parameter under the Light Settings sub parameter list. This should help you understand what parts of the 3D (and other) Script is for in altering the object.
HTH
David
www.davidmaudlin.com
Digital Architecture
AC28 USA • Mac mini M4 Pro OSX15 | 64 gb ram • MacBook Pro M3 Pro | 36 gb ram OSX14