J
Jorge Hawkins
Guest
I have been working with GameMaker Studio for four years now and I have been doing 2D projects with it for quite a while.
However, 3D is a whole new world, at least with GameMaker, and its rather unique 3D structure.
I've been trying to do something simple:
a camera rotating around an object. However, the models (basic primitives in this case) get chopped, and have a lot of problems.
Look at this screenshot:
I have only two objects:
-obj_3d (The camera, with a depth of 999).
Create event:
Step event:
Draw event:
--
obj_character (with a depth of 0)
As I mentioned before, I'm new to 3D, and a new perspective brings new problems. Could you please help me on this issue? It's driving me nuts.
However, 3D is a whole new world, at least with GameMaker, and its rather unique 3D structure.
I've been trying to do something simple:
a camera rotating around an object. However, the models (basic primitives in this case) get chopped, and have a lot of problems.
Look at this screenshot:
I have only two objects:
-obj_3d (The camera, with a depth of 999).
Create event:
Code:
var_controller_z = 8; //The z-position of the camera.
var_controller_xup = 0;
var_controller_yup = 0;
var_controller_zup = 0;
var_camera_target = obj_character; // The object the camera orbits towards.
var_camera_speed = 2; //Speed the camera moves around the object.
var_camera_distance = 64; // The distance from the object to the camera.
var_camera_position = 0; //Position counter.
Code:
x = var_camera_target.x + lengthdir_x(var_camera_distance, var_camera_position);
y = var_camera_target.y + lengthdir_y(var_camera_distance, var_camera_position);
var_camera_position += var_camera_speed;
if(keyboard_check(ord('Q'))){
var_camera_distance += 1;
} else if(keyboard_check(ord('A'))){
var_camera_distance -= 1;
}
if(keyboard_check(ord('W'))){
var_camera_speed += 1;
} else if(keyboard_check(ord('S'))){
var_camera_speed -= 1;
}
if(keyboard_check(ord('E'))){
var_controller_z += 0.1;
} else if(keyboard_check(ord('D'))){
var_controller_z -= 0.1;
}
Code:
draw_set_color(c_white);
d3d_set_projection(x,y,var_controller_z,obj_character.x,obj_character.y,1,0,0,1);
obj_character (with a depth of 0)
Code:
d3d_draw_floor(-512,-512,0,512,512,0,sprite_get_texture(spr_text_grass_test, 0), 10,10);
d3d_draw_block(x-16,y-16,-16,x+16,y+16,16,sprite_get_texture(sprite1,0), 1,1);
As I mentioned before, I'm new to 3D, and a new perspective brings new problems. Could you please help me on this issue? It's driving me nuts.