Legacy GM need help with 3d planet position

T

tiestolord

Guest
xcxcxc.png
im not using any kind of 3d camera only view in room, but object "planet" is on wrong position, this black hole is top border of texture, how can i change postion of object, something like 3d angle, anyone help?
 
Z

zircher

Guest
1. Rotate the model 90 degrees in your 3d modeler, export, and reload.
or
2. Use set identity, 3d rotation, and set intentity again in the draw event. [There's a good example in the help file.]
 
T

tiestolord

Guest
1. Rotate the model 90 degrees in your 3d modeler, export, and reload.
or
2. Use set identity, 3d rotation, and set intentity again in the draw event. [There's a good example in the help file.]
im using d3d_draw_ellipsoid code and i see only d3d rotation x,y or z and axis, i tryed everthing and I didnt mange to work it. can you help me with some sample :/
 
Z

zircher

Guest
I'll play with that tonight. I use a different approach with d3d models. So, the ellipsoid way will need a little trial and error on my part.
 
Z

zircher

Guest
Have patience, Grasshopper.

Looks like you need the d3d_transform_set_rotation_x and the d3d_transform_set_identity commands. The help file is your friend. :)

Code:
/// draw ellipsoid
d3d_start();
d3d_set_lighting(true);
d3d_light_define_point(1, -200, -123, -50, 5000, c_white);
d3d_light_enable(1, true);
d3d_light_define_ambient(c_white)
d3d_transform_set_rotation_x(90); 
d3d_draw_ellipsoid(100, 100, 100, 200, 200, 200, tex, 1, 1, 24);
d3d_transform_set_identity();
Note: Increment one of the other axis will allow you to rotate your globe.
 
T

tiestolord

Guest
yes mate it works, belive me i tryed :D but now i have problem with spinning.
d3d_transform_set_rotation_x(90+rot); but i need to spin left or right and thats y axis.
 
M

Misu

Guest
To spin left or right, according to the room xy coordinate, d3d_transform_set_rotation_Z would be the left or right.
 
T

tiestolord

Guest
nope i tryed, wont spin, only background is spinning. :/ when not using 3d camera, its like top down camera, and with zircher code, its turned for 90 degree, but when i tring to rotate it wont rotate because of constant position i think.
 
Last edited by a moderator:
Z

zircher

Guest
In my room, this makes for a spinning planet in the lower left corner. Inc is a variable that is increased (or decreased) by one in the step event with a little code to remove/add 360 if it gets too high or too low.
tex is just an assigned background image. ( tex = background_get_texture(back_zero); )
Note that the first rotation is set, the second rotations is added, and there is a translation. This is because we centered the ellipse around 0,0,0 so it would rotate properly.

Code:
/// draw ellipsoid
d3d_start();
d3d_set_lighting(true);
d3d_light_define_point(1, -200, -123, -50, 5000, c_white);
d3d_light_enable(1, true);
d3d_light_define_ambient(c_white)
d3d_transform_set_identity();
d3d_transform_set_rotation_x(90);
d3d_transform_add_rotation_y(inc);
d3d_transform_add_translation(100,100,100) 
d3d_draw_ellipsoid(-100, -100, -100, 100, 100, 100, tex, 1, 1, 24);
d3d_transform_set_identity();
 
Z

zircher

Guest
Give this a shot...

Code:
d3d_start();

d3d_set_lighting(true);
d3d_light_define_direction(1, -1, 0, .5, c_white);
d3d_light_enable(1, true);
// this can have an adverse effect on other graphical elements
d3d_light_define_ambient(c_dkgray)
// huh, lights don't work without this and it overwrites their colour?
draw_set_color(c_white);

d3d_transform_set_identity();
d3d_transform_set_rotation_x(90);
d3d_transform_add_rotation_y(inc);
d3d_transform_add_translation(150,150,150)
d3d_draw_ellipsoid(-100, -100, -100, 100, 100, 100, tex, 1, 1, 120);
d3d_transform_set_identity();

// set back to full bright
d3d_light_define_ambient(c_white)

d3d_end();
Note: You can probably move the light define and enable code to your create event. Or, if you end up with more that 8 lights you should create a light management object.

As to spending time on this, no problem. I used a different approach for my 3D project so figuring out how to do it this way is a learning opportunity.
 
Last edited by a moderator:
T

tiestolord

Guest
you are beast, it works like charm i manage to made my own with this now. But new problem is GUI objects al dimned or black 2. Depth does not helping :/
 
T

tiestolord

Guest
jeaaa its work now :D thx everyone, someone will need this codes 2 :D
 
Top