DarkBASIC Professional Help Wiki
Advertisement


This command will make the specified 3D object semi-transparent if supported by the current display card.

Syntax
GHOST OBJECT ON Object Number
GHOST OBJECT ON Object Number, Ghost Effect
Parameters
Object Number

Integer
The object number Ghost Effect Integer
This value is an integer number such as 1.

Returns

This command does not return a value.

Description

This technique is known as alpha-blending and causes the object to appear as a ghost image. If a value of one is specified for the dark ghosting, the object uses negative alphablending. The parameter should be specified using an integer value. Be aware this command assumes you are not directly controlling the Z depth flags with DISABLE OBJECT ZDEPTH, as the ghost command takes come control of Z behaviour. For transparency with using the ghost command, see SET OBJECT TRANSPARENCY.

Example Code
hide mouse:cls 0:autocam off

ObjectNumber=1

SecondObject=2

ImageNumber=1

make object sphere SecondObject,1

load object "models\model.x",ObjectNumber

load image "iron.jpg",ImageNumber

append object "models\extraanim.x", ObjectNumber, total object frames(ObjectNumber)+1

set object interpolation ObjectNumber,50

position object ObjectNumber,0,0,0

position object SecondObject,0,0,0

position camera 0,2,4

point camera 0,0,0

while mouseclick()=0

set cursor 0,0

print "press q to ghost object on"

if inkey$()="q" then ghost object on ObjectNumber

print "press w to ghost object off"

if inkey$()="w" then ghost object off ObjectNumber

print "press up arrow key"

if upkey()=1 then move camera  1:while scancode()<>0:endwhile

print "press down arrow key"

if downkey()=1 then move camera -1:while scancode()<>0:endwhile

print "press left arrow key"

if leftkey()=1 then turn camera left 1

print "press right arrow key"

if rightkey()=1 then turn camera right 1

endwhile

while mouseclick()=1:endwhile

if object exist(ObjectNumber)=1 then delete object ObjectNumber

if object exist(SecondObject)=1 then delete object SecondObject

if image exist(ImageNumber)=1 then delete image ImageNumber

end
Advertisement