Skip to content

Commit

Permalink
Merge pull request #48 from QuantumCoderQC/master
Browse files Browse the repository at this point in the history
Fix and Update examples. Added documentation to some examples.
  • Loading branch information
luboslenco authored Mar 12, 2022
2 parents 6235550 + 192f22c commit a1d69da
Show file tree
Hide file tree
Showing 22 changed files with 29 additions and 13 deletions.
Binary file modified animation_blend/animation_blend.blend
Binary file not shown.
2 changes: 2 additions & 0 deletions animation_movebone/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
The left arm is controlled by Inverse Kinematics with a finger following a ball movement. Use `W` `S` `A` and `D` keys to move the ball.
The right arm is controlled by Forward Kinematics with a Haxe script.
34 changes: 22 additions & 12 deletions animation_movebone/Sources/arm/MoveBoneFK.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package arm;

import iron.math.Vec4;
import iron.math.Quat;
import iron.object.BoneAnimation;
import iron.math.Mat4;

Expand All @@ -13,23 +15,31 @@ class MoveBoneFK extends iron.Trait {
// Fetch armature animation
var anim = cast(object.children[0].animation, BoneAnimation);
// Fetch bone
var bone = anim.getBone("mixamorig:LeftArm");
var bone = anim.getBone("mixamorig:RightArm");

// Manipulating bone in local space
// var m = anim.getBoneMat(bone);
//var m = anim.getBoneMat(bone);
// anim.notifyOnUpdate(function() {
// m.translate(Math.sin(iron.system.Time.time()) * 50, 0, 0);
// });
// var offset = new Quat().fromEuler(0, Math.sin(iron.system.Time.time()), 0);
// m.applyQuat(offset);
//});

// Manipulating bone in world space
var m = anim.getBoneMat(bone);
var w = anim.getAbsMat(bone);
var iw = Mat4.identity();
// Manipulating bone in world space
anim.notifyOnUpdate(function() {
m.setFrom(w);
m.translate(10, 0, Math.sin(iron.system.Time.time()) * 50);
iw.getInverse(w);
m.multmat(iw);
// Get bone mat in world space
var m = anim.getAbsWorldMat(bone);
// Decompose transform
var loc = new Vec4();
var scl = new Vec4();
var rot = new Quat();
m.decompose(loc, rot, scl);
// Apply rotation
var offset = new Quat().fromEuler(Math.sin(iron.system.Time.time()), 0, 0);
rot.multquats(offset, rot);
// Compose world matrix
m.compose(loc, rot, scl);
// Set bone matrix from world matrix
anim.setBoneMatFromWorldMat(m, bone);
});
});
}
Expand Down
Binary file modified animation_movebone/animation_movebone.blend
Binary file not shown.
Binary file modified debug_draw/debug_draw.blend
Binary file not shown.
Binary file modified file_storage/file_storage.blend
Binary file not shown.
Binary file modified game_bowling/game_bowling.blend
Binary file not shown.
Empty file.
1 change: 1 addition & 0 deletions logic_callgroup/Bundled/canvas/MyCanvas.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name":"untitled","x":0,"y":0,"width":1280,"height":720,"theme":"Default Light","elements":[{"id":0,"type":0,"name":"Text","event":"","x":120,"y":140,"width":260,"height":48,"rotation":0,"text":"My Text","asset":"","progress_at":0,"progress_total":100,"strength":1,"alignment":0,"anchor":0,"parent":null,"children":[],"visible":true}],"assets":[]}
2 changes: 1 addition & 1 deletion logic_callgroup/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
- Keyboard `C` NodeTreeA calls NodeTreeB, NodeTreeB sets current time to global object property
- Keyboard `V` NodeTreeA prints value of global object property
- Check console output
- Check canvas overlay text
Binary file modified logic_callgroup/logic_callgroup.blend
Binary file not shown.
Binary file modified logic_camera_pan/logic_camera_pan.blend
Binary file not shown.
Binary file modified logic_camera_zoom/logic_camera_zoom.blend
Binary file not shown.
Empty file.
1 change: 1 addition & 0 deletions logic_gamepad/Bundled/canvas/MyCanvas.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name":"untitled","x":0,"y":0,"width":1280,"height":720,"theme":"Default Light","elements":[{"id":2,"type":12,"name":"Filled_Rectangle","event":"","x":0,"y":0,"width":250,"height":50,"rotation":0,"text":"My Filled_Rectangle","asset":"","progress_at":0,"progress_total":100,"strength":1,"alignment":0,"anchor":0,"parent":null,"children":[],"visible":true,"color":null},{"id":1,"type":6,"name":"VGamepad","event":"","x":0,"y":0,"width":250,"height":50,"rotation":0,"text":"Virtual Gamepad","asset":"","progress_at":0,"progress_total":100,"strength":1,"alignment":0,"anchor":0,"parent":null,"children":[],"visible":true,"color_text":-6738141,"color":-3392436,"color_hover":-5726816}],"assets":[]}
Binary file modified logic_gamepad/logic_gamepad.blend
Binary file not shown.
Binary file modified logic_object_rotate/logic_object_rotate.blend
Binary file not shown.
Binary file modified material_params/material_params.blend
Binary file not shown.
Binary file modified material_shaders/material_shaders.blend
Binary file not shown.
2 changes: 2 additions & 0 deletions script_camera_lerp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Use keys `A` and `D` to rotate the cube
The camera follows the cube smoothly with interpolation
Binary file modified script_camera_lerp/script_camera_lerp.blend
Binary file not shown.
Binary file modified tween/tween.blend
Binary file not shown.

0 comments on commit a1d69da

Please sign in to comment.