Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions sky/packages/sky/example/game/lib/node3d.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
part of sprites;

class Node3D extends Node {

double _rotationX = 0.0;

double get rotationX => _rotationX;

set rotationX(double rotationX) {
_rotationX = rotationX;
invalidateTransformMatrix();
}

double _rotationY = 0.0;

double get rotationY => _rotationY;

set rotationY(double rotationY) {
_rotationY = rotationY;
invalidateTransformMatrix();
}

Matrix4 computeTransformMatrix() {
// Apply normal 2d transforms
Matrix4 matrix = super.computeTransformMatrix();


matrix.translate(0.0, 0.0, 500.0);

// Rotate around x and y axis
matrix.rotateY(radians(_rotationY));
matrix.rotateX(radians(_rotationX));

return matrix;
}
}
1 change: 1 addition & 0 deletions sky/packages/sky/example/game/lib/sprites.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ part 'action.dart';
part 'color_secuence.dart';
part 'image_map.dart';
part 'node.dart';
part 'node3d.dart';
part 'node_with_size.dart';
part 'particle_system.dart';
part 'sprite.dart';
Expand Down