This command changes the angle of the object relative to its own position. It changes the angle immediately or at a speed that you can specify.

 object.SetRelativeAngle(xangle, yangle, zangle, time) 


xangle , yangle , and zangle

Refer to the number of radians to add about each axis


Refers to the number of seconds for which the rotation is to take place (in seconds)


Alternately, you can say

 object.SetRelativeAngle(another3DObject, time), 

where another3DObject refers to another object from which to set the angle.

It is important to know that there is a difference between the SetRelativeAngle command and the AddAngle command. The AddAngle command moves the object about the stationary world axes. The SetRelativeAngle moves the object about its own x, y, and z axes.

Sample Code

The following code illustrates the difference between moving objects with the AddAngle command and moving them with the SetRelativeAngle command by moving two different objects using the two commands.

 oworld = New World(); ocamera = New Camera(oworld); sphere = oworld.CreateBrick(50,50,50); sphere2 = oworld.CreateBrick(50,50,50); sphere2.SetPosition(100,0,0); ocamera.MoveBack(1200); ocamera.Walk(); sphere.AddAngle(1,2,3,10); //Rotates it in 5 seconds. sphere2.SetRelativeAngle(1,2,3,10); //Rotates it in 5 seconds. //Show the axes of the two objects. oworld.ShowObjectAxis(); //Loop While(TRUE) { } 

SetShadowMode selects one of two types of shadows to be used ”true or texture.


SetShadowTexture selects the picture to be used as a shadow in the texture mode (see this demonstrated in the code later in this section).

SetShadowTextureSize sets the size of the shadow in the texture mode (see this demonstrated in the code later in this section).

EnableShadow turns on the shadow mode.


There are two types of shadow modes:


This type is faster than True Mode and uses a texture that you specify as the shadow.


This type makes a true shadow of the object.


Objects in Jamagic can have shadows that rest underneath them. Shadows are displayed on static backgrounds (backgrounds that have been declared as static objects).

True shadows are slower (this is important to know if your game is starting to run slowly). They take the form of a dark surface underneath your object and they have a shape similar to the object. Textured shadows are fake in that they are images you specify to represent the shape of the shadow rather than the shape of the object and its shadow. Textured shadows run faster.

Sample Code

The following code allows you to observe the differences between the two types of shadow by commenting out the appropriate lines. Please note that shadows must be enabled using the EnableShadow command.

 oworld = New World(); ocamera = New Camera(oworld); sphere = oworld.CreateSphere(50,50,50,25,25); sphere.SetPosition(0,200,0); mats = New Material(oworld,,RED,"mats"); mats.SetFlat(); sphere.ReplaceMaterial(mats); plane = oworld.CreatePlane(600,600); Matplane = New Material(oworld, ,GREEN, "Matplane"); matplane.SetFlat; plane.ReplaceMaterial(matplane); plane.SetAngle(-Pi/2,0,0); plane.SetStatic(); oworld.Optimize(ocamera); ocamera.MoveBack(1200); ocamera.MoveUp(200); sphere.Walk(); // Next line is for true shadow mode. // sphere.SetShadowMode(Object.SHADOW_MODE_TRUE); //Next 4 lines are for texture shadow mode. Wheel is the //picture //to be used as a shadow. If you run this program, you must //have // an image under "pictures" named "wheel," or some other name // if you modify the code. tex = New Texture(oworld, "wheel"); sphere.SetShadowMode(Object.SHADOW_MODE_TEXTURE); sphere.SetShadowTexture(tex); sphere.SetShadowTextureSize(100,100); sphere.EnableShadow(); //Loop While(TRUE); 

Elementary Game Programming and Simulators Using Jamagic
Elementary Game Programming & Simulations Using Jamagic (Charles River Media Game Development)
ISBN: 1584502614
EAN: 2147483647
Year: 2002
Pages: 105
Authors: Sergio Perez © 2008-2017.
If you may any questions please contact us: