add flag for affectsCollidingTransform, add setParent method for transforms
This commit is contained in:
@@ -564,11 +564,17 @@ abstract class FilamentController {
|
||||
/// If there is a collision between the controlled entity and [collidableEntity], the transform will not be updated.
|
||||
///
|
||||
Future addCollisionComponent(FilamentEntity collidableEntity,
|
||||
{void Function(int entityId)? callback});
|
||||
{void Function(int entityId)? callback,
|
||||
bool affectsCollingTransform = false});
|
||||
|
||||
///
|
||||
/// Creates a (renderable) entity with the specified geometry and adds to the scene.
|
||||
///
|
||||
Future createGeometry(
|
||||
List<double> vertices, List<int> indices, String? materialPath);
|
||||
|
||||
///
|
||||
/// Sets the parent transform of [child] to the transform of [parent].
|
||||
///
|
||||
Future setParent(FilamentEntity child, FilamentEntity parent);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import 'package:flutter_filament/filament_controller.dart';
|
||||
import 'package:flutter_filament/animations/animation_data.dart';
|
||||
import 'package:flutter_filament/generated_bindings.dart';
|
||||
import 'package:flutter_filament/hardware/hardware_keyboard_listener.dart';
|
||||
import 'package:flutter_filament/hardware/hardware_keyboard_poll.dart';
|
||||
|
||||
import 'package:flutter_filament/rendering_surface.dart';
|
||||
import 'package:vector_math/vector_math_64.dart';
|
||||
|
||||
@@ -1391,7 +1391,8 @@ class FilamentControllerFFI extends FilamentController {
|
||||
|
||||
@override
|
||||
Future addCollisionComponent(FilamentEntity entity,
|
||||
{void Function(int entityId)? callback}) async {
|
||||
{void Function(int entityId)? callback,
|
||||
bool affectsCollingTransform = false}) async {
|
||||
if (_assetManager == null) {
|
||||
throw Exception("AssetManager must be non-null");
|
||||
}
|
||||
@@ -1400,9 +1401,11 @@ class FilamentControllerFFI extends FilamentController {
|
||||
if (callback != null) {
|
||||
var ptr =
|
||||
NativeCallable<Void Function(Int32 entityId)>.listener(callback);
|
||||
add_collision_component(_assetManager!, entity, ptr.nativeFunction);
|
||||
add_collision_component(
|
||||
_assetManager!, entity, ptr.nativeFunction, affectsCollingTransform);
|
||||
} else {
|
||||
add_collision_component(_assetManager!, entity, nullptr);
|
||||
add_collision_component(
|
||||
_assetManager!, entity, nullptr, affectsCollingTransform);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1440,4 +1443,12 @@ class FilamentControllerFFI extends FilamentController {
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
@override
|
||||
Future setParent(FilamentEntity child, FilamentEntity parent) async {
|
||||
if (_assetManager == null) {
|
||||
throw Exception("Asset manager must be non-null");
|
||||
}
|
||||
set_parent(_assetManager!, child, parent);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user