diff --git a/res/project/game.proj b/res/project/game.proj index 5e6a593..4686656 100644 --- a/res/project/game.proj +++ b/res/project/game.proj @@ -27,7 +27,11 @@ { "id": "SideScene", "path": "scenes://SideScene.evsc" - } + }, + { + "id": "TestScene", + "path": "scenes://TestScene.evsc" + }, ], "activeScene": "MainScene" } diff --git a/res/project/res/scenes/TestScene.evsc b/res/project/res/scenes/TestScene.evsc new file mode 100644 index 0000000..3d043c7 --- /dev/null +++ b/res/project/res/scenes/TestScene.evsc @@ -0,0 +1,1463 @@ +{ + "id":"TestScene", + "nodes": [ + { + "id": "CameraTransformOverride", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 20.0, 7.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + } + ], + "children": [ + { + "id": "Camera", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 0.0, 0.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "ScriptComponent", + "script_name": "MainCameraController", + "script_path": "scripts://TestScene/Camera.lua" + } + ], + "children": [ + { + "id": "RotationHelper", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 0.0, 0.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "CameraComponent", + "view": "Perspective", + "fov": 90, + "near": 0.001, + "far": 1000, + "aspectRatio": 1.3333 + }, + { + "type": "ScriptComponent", + "script_name": "MainCameraRotationHelper", + "script_path": "scripts://TestScene/CameraHelper.lua" + } + ] + } + ] + }, + ] + } + { + "id": "SideCamera", + "components": [ + { + "type": "TransformComponent", + "position": [55.0, 0.0, -15.0], + "rotation": [0.0, 90.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "CameraComponent", + "view": "Perspective", + "fov": 90, + "near": 0.001, + "far": 1000, + "aspectRatio": 1.3333 + } + ] + }, + { + "id": "Player", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 0.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 0.3, + "restitution": 0.0, + "collisionShape": { + "type": "Box", + "halfExtents": [1.0, 1.0, 1.0] + } + }, + { + "type": "ScriptComponent", + "script_name": "MainPlayerController", + "script_path": "scripts://TestScene/Player.lua" + } + ] + }, + { + "id": "Ball1", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball2", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball3", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball4", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball5", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball6", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball7", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball9", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball10", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball11", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball12", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball13", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball14", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball15", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball16", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball17", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball18", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball19", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball21", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball22", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball23", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball24", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball25", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball26", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball27", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball28", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball29", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball30", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball31", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball32", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball33", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball34", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball35", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball36", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball37", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball38", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball39", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball40", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball41", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball42", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball43", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball44", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball45", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball46", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball47", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball48", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball49", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball50", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball51", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball52", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball53", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball54", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball55", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball56", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball57", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball58", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball59", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball60", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Ball61", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 10.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Dynamic", + "mass": 1.0, + "restitution": 1.0, + "collisionShape": { + "type": "Sphere", + "radius": 1.0 + } + } + ] + }, + { + "id": "Map", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 0.0, 0.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + } + ], + "children": [ + { + "id": "Ground", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, -5.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Static", + "mass": 0.0, + "restitution": 1.0, + "collisionShape": { + "type": "Box", + "halfExtents": [100.0, 1.0, 100.0] + } + } + ] + }, + { + "id": "WallRight", + "components": [ + { + "type": "TransformComponent", + "position": [99.0, 0.0, -14.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Static", + "mass": 0.0, + "restitution": 0.0, + "collisionShape": { + "type": "Box", + "halfExtents": [1.0, 4.0, 99.0] + } + } + ] + }, + { + "id": "WallLeft", + "components": [ + { + "type": "TransformComponent", + "position": [-99.0, 0.0, -14.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Static", + "mass": 0.0, + "restitution": 0.0, + "collisionShape": { + "type": "Box", + "halfExtents": [1.0, 4.0, 99.0] + } + } + ] + }, + { + "id": "WallFront", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 0.0, 84.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Static", + "mass": 0.0, + "restitution": 0.0, + "collisionShape": { + "type": "Box", + "halfExtents": [98.0, 4.0, 1.0] + } + } + ] + }, + { + "id": "WallBack", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 0.0, -114.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Static", + "mass": 0.0, + "restitution": 0.0, + "collisionShape": { + "type": "Box", + "halfExtents": [100.0, 4.0, 1.0] + } + } + ] + } + ] + } + ], + "activeCamera": "CameraTransformOverride.Camera.RotationHelper", +} diff --git a/res/project/res/scripts/TestScene/Camera.lua b/res/project/res/scripts/TestScene/Camera.lua new file mode 100644 index 0000000..61abb3d --- /dev/null +++ b/res/project/res/scripts/TestScene/Camera.lua @@ -0,0 +1,66 @@ +this.on_init = function() + this.speed = 2.1 + this.original_position = this.position + this.angles = Vec3:new() + this.mouse_sens = 0.01 + this.cursor_locked = false +end + +this.toggleCursor = function() + if this.cursor_locked then + Input.unlockCursor() + else + Input.lockCursor() + end + this.cursor_locked = not this.cursor_locked +end + +this.on_update = function() + local deltaMouseMovement = Input.getDeltaMousePos() + this.angles.y = this.angles.y - deltaMouseMovement.x * this.mouse_sens + this.eulerAngles = this.angles + + helper = this:getChild('RotationHelper') + + if Input.getKeyJustPressed(Input.KeyCode.Enter) then + gotoScene('SideScene') + end + + local pos = this.position + if Input.getKeyDown(Input.KeyCode.Up) then + pos = pos + helper.forward * this.speed + end + if Input.getKeyDown(Input.KeyCode.Down) then + pos = pos - helper.forward * this.speed + end + if Input.getKeyDown(Input.KeyCode.Right) then + pos = pos + helper.right * this.speed + end + if Input.getKeyDown(Input.KeyCode.Left) then + pos = pos - helper.right * this.speed + end + + local mb0 = Input.getMouseButtonJustPressed(0) + local mb1 = Input.getMouseButtonJustPressed(1) + local mb2 = Input.getMouseButtonJustPressed(2) + + if mb0 or mb1 then + hit = rayCast(this.worldPosition, helper.forward, 300) + if(hit.hasHit) then + local hitForce = 1000 + rb = hit.object:getComponent(Rigidbody) + if mb0 then + rb:addForce(hit.hitNormal * -hitForce) + elseif mb1 then + rb:addForce(hit.hitNormal * hitForce) + end + end + end + + if mb2 then + this.toggleCursor() + end + + this.position = pos +end + diff --git a/res/project/res/scripts/TestScene/CameraHelper.lua b/res/project/res/scripts/TestScene/CameraHelper.lua new file mode 100644 index 0000000..41266f0 --- /dev/null +++ b/res/project/res/scripts/TestScene/CameraHelper.lua @@ -0,0 +1,10 @@ +this.on_init = function() + this.angles = Vec3:new() + this.mouse_sens = 0.01 +end + +this.on_update = function() + local deltaMouseMovement = Input.getDeltaMousePos() + this.angles.x = this.angles.x - deltaMouseMovement.y * this.mouse_sens + this.eulerAngles = this.angles +end diff --git a/res/project/res/scripts/TestScene/Child.lua b/res/project/res/scripts/TestScene/Child.lua new file mode 100644 index 0000000..2c4a2cf --- /dev/null +++ b/res/project/res/scripts/TestScene/Child.lua @@ -0,0 +1,14 @@ +this.on_init = function () + this.custom_eulerangles = Vec3:new() + this.custom_angularvelocity = Vec3:new(0, 0.01, 0) +end + +this.on_fixedupdate = function () + if Input.getKeyDown(Input.KeyCode.Left) then + this.custom_eulerangles:add(Vec3:new(0,0.01,0)) + end + if Input.getKeyDown(Input.KeyCode.Right) then + this.custom_eulerangles:sub(Vec3:new(0,0.01,0)) + end + this.eulerAngles = this.custom_eulerangles +end diff --git a/res/project/res/scripts/TestScene/Player.lua b/res/project/res/scripts/TestScene/Player.lua new file mode 100644 index 0000000..90782f6 --- /dev/null +++ b/res/project/res/scripts/TestScene/Player.lua @@ -0,0 +1,22 @@ +-- this.on_collisionenter = function(other) + -- other.position = other.position + Vec3:new(3.2, 0, 0) +-- end + +this.on_update = function () + rb = this:getComponent(Rigidbody) + if Input.getKeyDown(Input.KeyCode.Space) then + rb:addForce(Vec3:new(0, 100, 0)) + end + if Input.getKeyDown(Input.KeyCode.D) then + rb:addForce(Vec3:new(10, 0, 0)) + end + if Input.getKeyDown(Input.KeyCode.A) then + rb:addForce(Vec3:new(-10, 0, 0)) + end + if Input.getKeyDown(Input.KeyCode.W) then + rb:addForce(Vec3:new(0, 0, -10)) + end + if Input.getKeyDown(Input.KeyCode.S) then + rb:addForce(Vec3:new(0, 0, 10)) + end +end