walk,mouse
This commit is contained in:
parent
ebdbde5244
commit
3062149daf
@ -36,13 +36,14 @@
|
||||
"resources":[
|
||||
{"id":{"name":"OpenVR","path":"extensions/OpenVR/OpenVR.yy",},},
|
||||
{"id":{"name":"obj_camera","path":"objects/obj_camera/obj_camera.yy",},},
|
||||
{"id":{"name":"obj_controller_test","path":"objects/obj_controller_test/obj_controller_test.yy",},},
|
||||
{"id":{"name":"obj_init","path":"objects/obj_init/obj_init.yy",},},
|
||||
{"id":{"name":"obj_test","path":"objects/obj_test/obj_test.yy",},},
|
||||
{"id":{"name":"obj_vr_system","path":"objects/obj_vr_system/obj_vr_system.yy",},},
|
||||
{"id":{"name":"rm_game","path":"rooms/rm_game/rm_game.yy",},},
|
||||
{"id":{"name":"rm_init","path":"rooms/rm_init/rm_init.yy",},},
|
||||
{"id":{"name":"create_projection_matrix","path":"scripts/create_projection_matrix/create_projection_matrix.yy",},},
|
||||
{"id":{"name":"create_view_matrix","path":"scripts/create_view_matrix/create_view_matrix.yy",},},
|
||||
{"id":{"name":"transpose_matrix","path":"scripts/transpose_matrix/transpose_matrix.yy",},},
|
||||
{"id":{"name":"Shader1","path":"shaders/Shader1/Shader1.yy",},},
|
||||
{"id":{"name":"spr_test","path":"sprites/spr_test/spr_test.yy",},},
|
||||
],
|
||||
|
@ -1,9 +1,42 @@
|
||||
/// @description 여기에 설명 삽입
|
||||
// 이 에디터에 코드를 작성할 수 있습니다
|
||||
|
||||
view_matrix = create_view_matrix(0,0,0,
|
||||
1,0,0,
|
||||
0,1,0,
|
||||
0,0,1
|
||||
);
|
||||
projection_matrix = create_projection_matrix(16,9,8,6000);
|
||||
global.camera_x = 0;
|
||||
global.camera_y = 0;
|
||||
global.camera_z = 0;
|
||||
global.camera_pitch = 0;
|
||||
global.camera_yaw = 0;
|
||||
global.camera_roll = 0;
|
||||
|
||||
global.projection_matrix = create_projection_matrix(16,9,8,6000);
|
||||
|
||||
function set_view_matrix(){
|
||||
global.view_pos_matrix = [
|
||||
1,0,0,-global.camera_x,
|
||||
0,1,0,-global.camera_y,
|
||||
0,0,1,-global.camera_z,
|
||||
0,0,0,1
|
||||
];
|
||||
var view_yaw_rotation_matrix = [
|
||||
cos(global.camera_yaw),0,-sin(global.camera_yaw),0,
|
||||
0, 1,0, 0,
|
||||
sin(global.camera_yaw),0,cos(global.camera_yaw), 0,
|
||||
0, 0,0, 1
|
||||
];
|
||||
var view_pitch_rotation_matrix = [
|
||||
1,0,0,0,
|
||||
0,cos(global.camera_pitch),sin(global.camera_pitch),0,
|
||||
0,-sin(global.camera_pitch),cos(global.camera_pitch),0,
|
||||
0,0,0,1
|
||||
];
|
||||
var view_roll_rotation_matrix = [
|
||||
cos(global.camera_roll),sin(global.camera_roll),0,0,
|
||||
-sin(global.camera_roll),cos(global.camera_roll),0,0,
|
||||
0,0,1,0,
|
||||
0,0,0,1
|
||||
];
|
||||
global.view_rotation_matrix = matrix_multiply(view_roll_rotation_matrix,matrix_multiply(view_pitch_rotation_matrix,view_yaw_rotation_matrix));
|
||||
}
|
||||
|
||||
global.camera_z = -1000;
|
||||
set_view_matrix();
|
@ -1,7 +1,9 @@
|
||||
/// @description 여기에 설명 삽입
|
||||
// 이 에디터에 코드를 작성할 수 있습니다
|
||||
|
||||
|
||||
set_view_matrix();
|
||||
var _camera = camera_get_active();
|
||||
camera_set_view_mat(_camera,matrix_build_lookat(0,0,-1000,500,500,0,0,0,1));
|
||||
camera_set_proj_mat(_camera,projection_matrix);
|
||||
camera_set_view_mat(_camera,transpose_matrix(matrix_multiply(global.view_rotation_matrix,global.view_pos_matrix),4,4));
|
||||
camera_set_proj_mat(_camera,transpose_matrix(global.projection_matrix,4,4));
|
||||
camera_apply(_camera);
|
@ -0,0 +1,9 @@
|
||||
/// @description 여기에 설명 삽입
|
||||
// 이 에디터에 코드를 작성할 수 있습니다
|
||||
spd = 10;
|
||||
|
||||
mouse_sensitivity = 0.001;
|
||||
mouse_x_prev = device_mouse_x_to_gui(0);
|
||||
mouse_y_prev = device_mouse_x_to_gui(0);
|
||||
|
||||
window_mouse_set_locked(true);
|
@ -0,0 +1,23 @@
|
||||
/// @description 여기에 설명 삽입
|
||||
// 이 에디터에 코드를 작성할 수 있습니다
|
||||
a = 0;
|
||||
if(keyboard_check(ord("W"))){
|
||||
a = 1;
|
||||
global.camera_x += spd*sin(global.camera_yaw);
|
||||
global.camera_z += spd*cos(global.camera_yaw);
|
||||
}
|
||||
if(keyboard_check(ord("A"))){
|
||||
global.camera_x += -spd*cos(global.camera_yaw);
|
||||
global.camera_z += spd*sin(global.camera_yaw);
|
||||
}
|
||||
if(keyboard_check(ord("S"))){
|
||||
global.camera_x += -spd*sin(global.camera_yaw);
|
||||
global.camera_z += -spd*cos(global.camera_yaw);
|
||||
}
|
||||
if(keyboard_check(ord("D"))){
|
||||
global.camera_x += spd*cos(global.camera_yaw);
|
||||
global.camera_z += -spd*sin(global.camera_yaw);
|
||||
}
|
||||
|
||||
global.camera_yaw += mouse_sensitivity*(window_mouse_get_delta_x());
|
||||
global.camera_pitch += -mouse_sensitivity*(window_mouse_get_delta_y());
|
36
lowpoly-walking-simulator/objects/obj_controller_test/obj_controller_test.yy
generated
Normal file
36
lowpoly-walking-simulator/objects/obj_controller_test/obj_controller_test.yy
generated
Normal file
@ -0,0 +1,36 @@
|
||||
{
|
||||
"$GMObject":"",
|
||||
"%Name":"obj_controller_test",
|
||||
"eventList":[
|
||||
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":3,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
|
||||
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
|
||||
],
|
||||
"managed":true,
|
||||
"name":"obj_controller_test",
|
||||
"overriddenProperties":[],
|
||||
"parent":{
|
||||
"name":"Objects",
|
||||
"path":"folders/Objects.yy",
|
||||
},
|
||||
"parentObjectId":null,
|
||||
"persistent":false,
|
||||
"physicsAngularDamping":0.1,
|
||||
"physicsDensity":0.5,
|
||||
"physicsFriction":0.2,
|
||||
"physicsGroup":1,
|
||||
"physicsKinematic":false,
|
||||
"physicsLinearDamping":0.1,
|
||||
"physicsObject":false,
|
||||
"physicsRestitution":0.1,
|
||||
"physicsSensor":false,
|
||||
"physicsShape":1,
|
||||
"physicsShapePoints":[],
|
||||
"physicsStartAwake":true,
|
||||
"properties":[],
|
||||
"resourceType":"GMObject",
|
||||
"resourceVersion":"2.0",
|
||||
"solid":false,
|
||||
"spriteId":null,
|
||||
"spriteMaskId":null,
|
||||
"visible":true,
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"$GMExtensionConfigSet": "GMExtensionConfigSet",
|
||||
"configurables": null
|
||||
}
|
@ -17,6 +17,7 @@
|
||||
{"name":"inst_141D2E27","path":"rooms/rm_game/rm_game.yy",},
|
||||
{"name":"inst_1003B785","path":"rooms/rm_game/rm_game.yy",},
|
||||
{"name":"inst_709C3E3F","path":"rooms/rm_game/rm_game.yy",},
|
||||
{"name":"inst_6DFDD5B9","path":"rooms/rm_game/rm_game.yy",},
|
||||
],
|
||||
"isDnd":false,
|
||||
"layers":[
|
||||
@ -31,6 +32,7 @@
|
||||
{"$GMRInstance":"","%Name":"inst_141D2E27","colour":4294967295,"frozen":false,"hasCreationCode":false,"ignore":false,"imageIndex":0,"imageSpeed":1.0,"inheritCode":false,"inheritedItemId":null,"inheritItemSettings":false,"isDnd":false,"name":"inst_141D2E27","objectId":{"name":"obj_test","path":"objects/obj_test/obj_test.yy",},"properties":[],"resourceType":"GMRInstance","resourceVersion":"2.0","rotation":0.0,"scaleX":1.0,"scaleY":1.0,"x":-608.0,"y":640.0,},
|
||||
{"$GMRInstance":"","%Name":"inst_1003B785","colour":4294967295,"frozen":false,"hasCreationCode":false,"ignore":false,"imageIndex":0,"imageSpeed":1.0,"inheritCode":false,"inheritedItemId":null,"inheritItemSettings":false,"isDnd":false,"name":"inst_1003B785","objectId":{"name":"obj_test","path":"objects/obj_test/obj_test.yy",},"properties":[],"resourceType":"GMRInstance","resourceVersion":"2.0","rotation":0.0,"scaleX":1.0,"scaleY":1.0,"x":-480.0,"y":-544.0,},
|
||||
{"$GMRInstance":"","%Name":"inst_709C3E3F","colour":4294967295,"frozen":false,"hasCreationCode":false,"ignore":false,"imageIndex":0,"imageSpeed":1.0,"inheritCode":false,"inheritedItemId":null,"inheritItemSettings":false,"isDnd":false,"name":"inst_709C3E3F","objectId":{"name":"obj_test","path":"objects/obj_test/obj_test.yy",},"properties":[],"resourceType":"GMRInstance","resourceVersion":"2.0","rotation":0.0,"scaleX":1.0,"scaleY":1.0,"x":640.0,"y":-864.0,},
|
||||
{"$GMRInstance":"","%Name":"inst_6DFDD5B9","colour":4294967295,"frozen":false,"hasCreationCode":false,"ignore":false,"imageIndex":0,"imageSpeed":1.0,"inheritCode":false,"inheritedItemId":null,"inheritItemSettings":false,"isDnd":false,"name":"inst_6DFDD5B9","objectId":{"name":"obj_controller_test","path":"objects/obj_controller_test/obj_controller_test.yy",},"properties":[],"resourceType":"GMRInstance","resourceVersion":"2.0","rotation":0.0,"scaleX":21.0,"scaleY":19.0,"x":0.0,"y":0.0,},
|
||||
],"layers":[],"name":"Instances","properties":[],"resourceType":"GMRInstanceLayer","resourceVersion":"2.0","userdefinedDepth":false,"visible":true,},
|
||||
{"$GMRInstanceLayer":"","%Name":"camera","depth":100,"effectEnabled":true,"effectType":null,"gridX":32,"gridY":32,"hierarchyFrozen":false,"inheritLayerDepth":false,"inheritLayerSettings":false,"inheritSubLayers":true,"inheritVisibility":true,"instances":[
|
||||
{"$GMRInstance":"","%Name":"inst_1DC451FD","colour":4294967295,"frozen":false,"hasCreationCode":false,"ignore":false,"imageIndex":0,"imageSpeed":1.0,"inheritCode":false,"inheritedItemId":null,"inheritItemSettings":false,"isDnd":false,"name":"inst_1DC451FD","objectId":{"name":"obj_camera","path":"objects/obj_camera/obj_camera.yy",},"properties":[],"resourceType":"GMRInstance","resourceVersion":"2.0","rotation":0.0,"scaleX":1.0,"scaleY":1.0,"x":0.0,"y":0.0,},
|
||||
|
@ -38,7 +38,7 @@
|
||||
},
|
||||
"sequenceId":null,
|
||||
"views":[
|
||||
{"hborder":32,"hport":768,"hspeed":-1,"hview":768,"inherit":false,"objectId":null,"vborder":32,"visible":false,"vspeed":-1,"wport":1366,"wview":1366,"xport":0,"xview":0,"yport":0,"yview":0,},
|
||||
{"hborder":32,"hport":1080,"hspeed":-1,"hview":1080,"inherit":false,"objectId":null,"vborder":32,"visible":true,"vspeed":-1,"wport":1920,"wview":1920,"xport":0,"xview":0,"yport":0,"yview":0,},
|
||||
{"hborder":32,"hport":768,"hspeed":-1,"hview":768,"inherit":false,"objectId":null,"vborder":32,"visible":false,"vspeed":-1,"wport":1366,"wview":1366,"xport":0,"xview":0,"yport":0,"yview":0,},
|
||||
{"hborder":32,"hport":768,"hspeed":-1,"hview":768,"inherit":false,"objectId":null,"vborder":32,"visible":false,"vspeed":-1,"wport":1366,"wview":1366,"xport":0,"xview":0,"yport":0,"yview":0,},
|
||||
{"hborder":32,"hport":768,"hspeed":-1,"hview":768,"inherit":false,"objectId":null,"vborder":32,"visible":false,"vspeed":-1,"wport":1366,"wview":1366,"xport":0,"xview":0,"yport":0,"yview":0,},
|
||||
@ -50,7 +50,7 @@
|
||||
"viewSettings":{
|
||||
"clearDisplayBuffer":true,
|
||||
"clearViewBackground":false,
|
||||
"enableViews":false,
|
||||
"enableViews":true,
|
||||
"inheritViewSettings":false,
|
||||
},
|
||||
"volume":1.0,
|
||||
|
@ -6,7 +6,7 @@ function create_projection_matrix(w, h, n, f){
|
||||
return [
|
||||
n/r, 0, 0, 0,
|
||||
0, n/t, 0, 0,
|
||||
0, 0, f/(f-n), 1,
|
||||
0, 0, -n*f/(f-n), 0
|
||||
0, 0, f/(f-n), -n*f/(f-n),
|
||||
0, 0, 1, 0
|
||||
];
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
// v2.3.0에 대한 스크립트 어셋 변경됨 자세한 정보는
|
||||
// https://help.yoyogames.com/hc/en-us/articles/360005277377 참조
|
||||
function create_view_matrix(xx,yy,zz,rx,ry,rz,ux,uy,uz,fx,fy,fz){
|
||||
return [
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 1
|
||||
];
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
// v2.3.0에 대한 스크립트 어셋 변경됨 자세한 정보는
|
||||
// https://help.yoyogames.com/hc/en-us/articles/360005277377 참조
|
||||
function transpose_matrix(original_arr,w,h){
|
||||
var _arr = [];
|
||||
for(var i = 0; i < w; i++){
|
||||
for(var j = 0; j < h; j++){
|
||||
_arr[j + i*h] = original_arr[i + j*w];
|
||||
}
|
||||
}
|
||||
|
||||
return _arr;
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
"$GMScript":"",
|
||||
"%Name":"create_view_matrix",
|
||||
"%Name":"transpose_matrix",
|
||||
"isCompatibility":false,
|
||||
"isDnD":false,
|
||||
"name":"create_view_matrix",
|
||||
"name":"transpose_matrix",
|
||||
"parent":{
|
||||
"name":"Scripts",
|
||||
"path":"folders/Scripts.yy",
|
Loading…
Reference in New Issue
Block a user