diff --git a/call_hx/call_hx.blend b/call_hx/call_hx.blend index 8bf7ae4..929d8ff 100644 Binary files a/call_hx/call_hx.blend and b/call_hx/call_hx.blend differ diff --git a/call_js/README.md b/call_js/README.md index e5f2c1a..ed0996f 100644 --- a/call_js/README.md +++ b/call_js/README.md @@ -1,2 +1,6 @@ -Check console. +Shows how to call js after clicking on a `Cube` object. + +- Requires html5 target and physics enabled. +- Check devtools for output. + https://github.com/armory3d/armory/wiki/js diff --git a/call_js/Sources/arm/CallJS.hx b/call_js/Sources/arm/CallJS.hx index 5b70b83..6361488 100644 --- a/call_js/Sources/arm/CallJS.hx +++ b/call_js/Sources/arm/CallJS.hx @@ -1,7 +1,7 @@ package arm; -import iron.system.Input; import armory.trait.physics.PhysicsWorld; +import iron.system.Input; // This example shows how to call JavaScript after clicking on a Cube object // Requires physics enabled and browser target @@ -22,8 +22,11 @@ class CallJS extends iron.Trait { // Check if picked object is our Cube if (rb != null && rb.object.name == 'Cube') { // Raw JS calls - js.Syntax.code('document.title = "Cube clicked!"'); - js.Syntax.code('console.log("Testing..");'); + js.Syntax.code('console.log("Cube clicked");'); + js.Syntax.code('document.title = "Cube clicked";'); + js.Syntax.code('window.alert("Cube clicked");'); + } else { + js.Syntax.code('console.log("click");'); } }); } diff --git a/call_js/call_js.blend b/call_js/call_js.blend index df781d4..9b840be 100644 Binary files a/call_js/call_js.blend and b/call_js/call_js.blend differ diff --git a/game_bowling/Bundled/canvas/MenuCanvas.json b/game_bowling/Bundled/canvas/MenuCanvas.json index 0190b28..bd2858b 100644 --- a/game_bowling/Bundled/canvas/MenuCanvas.json +++ b/game_bowling/Bundled/canvas/MenuCanvas.json @@ -1 +1 @@ -{"name":"untitled","x":0,"y":0,"width":960,"height":540,"elements":[{"id":1,"type":1,"name":"Image","event":"","x":0,"y":0,"width":1280,"height":720,"text":"Image","asset":"menu.jpg","color":-1,"anchor":0,"children":[]},{"id":0,"type":1,"name":"Image","event":"play","x":404,"y":197,"width":160,"height":160,"text":"Image","asset":"ui_play.png","color":-1,"anchor":4,"children":[]}],"assets":[{"name":"ui_play.png","file":"../../Assets/ui_play.png","id":0},{"name":"menu.jpg","file":"../../Assets/menu.jpg","id":1}]} \ No newline at end of file +{"name":"untitled","x":0,"y":0,"width":960,"height":540,"elements":[{"id":3,"type":1,"name":"Button","event":"play","x":400,"y":260,"width":160,"height":160,"rotation":0,"text":"My Image.002","asset":"ui_play.png","progress_at":0,"progress_total":100,"strength":1,"alignment":0,"anchor":0,"parent":null,"children":[],"visible":true},{"id":4,"type":1,"name":"Image","event":"","x":0,"y":0,"width":960,"height":540,"rotation":0,"text":"My Image","asset":"menu.jpg","progress_at":0,"progress_total":100,"strength":1,"alignment":0,"anchor":0,"parent":null,"children":[],"visible":true}],"assets":[{"name":"ui_play.png","file":"../../Assets/ui_play.png","id":0},{"name":"menu.jpg","file":"../../Assets/menu.jpg","id":1}],"theme":"Default Light"} \ No newline at end of file diff --git a/game_bowling/game_bowling.blend b/game_bowling/game_bowling.blend index 6d155e0..9ba6ce9 100644 Binary files a/game_bowling/game_bowling.blend and b/game_bowling/game_bowling.blend differ diff --git a/input_mouselock/README.md b/input_mouselock/README.md index 1ce955c..b3c035a 100644 --- a/input_mouselock/README.md +++ b/input_mouselock/README.md @@ -1,2 +1,3 @@ -Click to lock mouse, press ESC to unlock mouse. +Keyboard `Escape` to toggle mouse lock. + https://armory3d.org/api/iron/system/Mouse.html diff --git a/input_mouselock/input_mouselock.blend b/input_mouselock/input_mouselock.blend index 7146d73..fb5a0c0 100644 Binary files a/input_mouselock/input_mouselock.blend and b/input_mouselock/input_mouselock.blend differ diff --git a/instancing/instancing.blend b/instancing/instancing.blend index 92a9119..85f5237 100644 Binary files a/instancing/instancing.blend and b/instancing/instancing.blend differ diff --git a/logic_break/logic_break.blend b/logic_break/logic_break.blend index e6bb5a7..b6a60d9 100644 Binary files a/logic_break/logic_break.blend and b/logic_break/logic_break.blend differ diff --git a/logic_event_object/logic_event_object.blend b/logic_event_object/logic_event_object.blend index 253e469..6f16a3e 100644 Binary files a/logic_event_object/logic_event_object.blend and b/logic_event_object/logic_event_object.blend differ diff --git a/logic_hello_world/logic_hello_world.blend b/logic_hello_world/logic_hello_world.blend deleted file mode 100644 index 9b74703..0000000 Binary files a/logic_hello_world/logic_hello_world.blend and /dev/null differ diff --git a/logic_script/logic_script.blend b/logic_script/logic_script.blend index 14f5ea3..4331f39 100644 Binary files a/logic_script/logic_script.blend and b/logic_script/logic_script.blend differ diff --git a/logic_toy_car/logic_toy_car.blend b/logic_toy_car/logic_toy_car.blend new file mode 100644 index 0000000..bb3340d Binary files /dev/null and b/logic_toy_car/logic_toy_car.blend differ diff --git a/material_billboard/material_billboard.blend b/material_billboard/material_billboard.blend index ae799f6..d361de5 100644 Binary files a/material_billboard/material_billboard.blend and b/material_billboard/material_billboard.blend differ diff --git a/material_decal/material_decal.blend b/material_decal/material_decal.blend index 385c171..70527f5 100644 Binary files a/material_decal/material_decal.blend and b/material_decal/material_decal.blend differ diff --git a/material_params/README.md b/material_params/README.md index 3561411..6f73446 100644 --- a/material_params/README.md +++ b/material_params/README.md @@ -1 +1,8 @@ +Shows how to control material nodes at run-time. + +- Enable 'Parameter' property in 'Logic Node Editor - Properties - Armory Material Node' +- RGB, Value and Image Texture nodes are supported +- See 'MyTrait' script to set material parameters using Haxe +- See 'NodeTree' to set material parameters using logic nodes + https://github.com/armory3d/armory/wiki/materials#material-parameters diff --git a/material_params/Sources/arm/MyTrait.hx b/material_params/Sources/arm/MyTrait.hx index c210003..0d93ddf 100644 --- a/material_params/Sources/arm/MyTrait.hx +++ b/material_params/Sources/arm/MyTrait.hx @@ -3,6 +3,7 @@ package arm; import iron.math.Vec4; import iron.object.Object; import iron.object.Uniforms; +import iron.data.Data; import iron.data.MaterialData; import iron.system.Time; @@ -13,23 +14,17 @@ class MyTrait extends iron.Trait { public function new() { super(); - - notifyOnInit(function() { + notifyOnInit(() -> { // Register link callbacks Uniforms.externalVec3Links.push(vec3Link); Uniforms.externalFloatLinks.push(floatLink); Uniforms.externalTextureLinks.push(textureLink); }); - - iron.data.Data.getImage("tex1.png", function(image:kha.Image) { - tex1 = image; - }); - iron.data.Data.getImage("tex2.png", function(image:kha.Image) { - tex2 = image; - }); + Data.getImage("tex1.png", img -> tex1 = img ); + Data.getImage("tex2.png", img -> tex2 = img ); } - function vec3Link(object:Object, mat:MaterialData, link:String):iron.math.Vec4 { + function vec3Link(object:Object, mat:MaterialData, link:String):Vec4 { // object - currently bound object // mat - currently bound material // link - material node name @@ -43,7 +38,7 @@ class MyTrait extends iron.Trait { function floatLink(object:Object, mat:MaterialData, link:String):Null { if (link == "Value") { var t = Time.time(); - return Math.sin(t) * 0.5 + 0.5; + return Math.floor(t); } return null; } diff --git a/material_params/material_params.blend b/material_params/material_params.blend index 85c5844..0ff28d9 100644 Binary files a/material_params/material_params.blend and b/material_params/material_params.blend differ diff --git a/material_video/README.md b/material_video/README.md index 9607d60..8394c0f 100644 --- a/material_video/README.md +++ b/material_video/README.md @@ -1,7 +1,7 @@ -Note: Krom is not yet supported, please use HTML5 or native targets for now. -ffmpeg is required to process video files. +- Krom is not yet supported, please use HTML5 or native targets for now. +- ffmpeg is required to process video files. -1. Install ffmpeg binaries from https://ffmpeg.org -2. Point 'Edit - Preferences... - Add-ons - Armory - Advanced - FFMPEG Path' to ffmpeg binary -3. Play! +1. Install [ffmpeg](https://ffmpeg.org) +2. Point `Edit - Preferences… - Add-ons - Armory - Advanced - FFMPEG Path` to ffmpeg binary +3. Play 4. During the first build, video processing may take some time diff --git a/material_video/material_video.blend b/material_video/material_video.blend index fa99416..bb1a5a6 100644 Binary files a/material_video/material_video.blend and b/material_video/material_video.blend differ diff --git a/mesh_terrain/README.md b/mesh_terrain/README.md index 9f7f5f8..18e8f76 100644 --- a/mesh_terrain/README.md +++ b/mesh_terrain/README.md @@ -1,4 +1,5 @@ To generate terrain: + - Place your heightmap as `Bundled/heightmap_01.png` - Navigate to `Properties - Scene - Armory Terrain` - Set terrain dimensions using `Sector Size` @@ -6,4 +7,4 @@ To generate terrain: - Click `Generate` - Adjust terrain material -Check terrain template: +See diff --git a/physics_raycast/README.md b/physics_raycast/README.md index 317f41f..0ff7659 100644 --- a/physics_raycast/README.md +++ b/physics_raycast/README.md @@ -1 +1,4 @@ +- Keyboard `L/R` Rotate cone +- Mouse `L` Raycast in cone direction + https://github.com/armory3d/armory/wiki/physics#raycast diff --git a/physics_raycast/Sources/arm/RayCastTrait.hx b/physics_raycast/Sources/arm/RayCastTrait.hx index c320265..12b497f 100644 --- a/physics_raycast/Sources/arm/RayCastTrait.hx +++ b/physics_raycast/Sources/arm/RayCastTrait.hx @@ -9,9 +9,10 @@ class RayCastTrait extends iron.Trait { public function new() { super(); + var mouse = iron.system.Input.getMouse(); + var keyboard = iron.system.Input.getKeyboard(); + notifyOnUpdate(function() { - var mouse = iron.system.Input.getMouse(); - var keyboard = iron.system.Input.getKeyboard(); if (mouse.down()) { var physics = PhysicsWorld.active; @@ -30,9 +31,9 @@ class RayCastTrait extends iron.Trait { var hit = physics.rayCast(from, to); var rb = (hit != null) ? hit.rb : null; - if (rb != null) { - trace(rb.object.name); - } + var info = ''; + if( rb != null ) info += ' ${rb.object.name}'; + trace(info); } if (keyboard.down("left")) { diff --git a/physics_raycast/physics_raycast.blend b/physics_raycast/physics_raycast.blend index f6f0cc5..aa5606d 100644 Binary files a/physics_raycast/physics_raycast.blend and b/physics_raycast/physics_raycast.blend differ diff --git a/render_to_texture/README.md b/render_to_texture/README.md index e811be7..27effff 100644 --- a/render_to_texture/README.md +++ b/render_to_texture/README.md @@ -1 +1,2 @@ -Press keyboard r, t, f, g, v, b to rotate suzanne \ No newline at end of file +#### Keyboard +`R T F G V B` to rotate suzanne diff --git a/render_to_texture/render_to_texture.blend b/render_to_texture/render_to_texture.blend index 4f343c4..ff15269 100644 Binary files a/render_to_texture/render_to_texture.blend and b/render_to_texture/render_to_texture.blend differ diff --git a/render_voxelao_teapots/render_voxelao_teapots.blend b/render_voxelao_teapots/render_voxelao_teapots.blend index 5496346..4328970 100644 Binary files a/render_voxelao_teapots/render_voxelao_teapots.blend and b/render_voxelao_teapots/render_voxelao_teapots.blend differ diff --git a/sound/ambient.wav b/sound/ambient.wav new file mode 100644 index 0000000..d1a1132 Binary files /dev/null and b/sound/ambient.wav differ diff --git a/sound/sound.blend b/sound/sound.blend index e64bcb0..9cb08e8 100644 Binary files a/sound/sound.blend and b/sound/sound.blend differ diff --git a/world_sun_direction/world_sun_direction.blend b/world_sun_direction/world_sun_direction.blend index 9a4dce3..ee242a7 100644 Binary files a/world_sun_direction/world_sun_direction.blend and b/world_sun_direction/world_sun_direction.blend differ