support collisions & restructure transforms to only update once per frame
This commit is contained in:
@@ -538,4 +538,11 @@ abstract class FilamentController {
|
||||
|
||||
Future<EntityTransformController> control(FilamentEntity entity,
|
||||
{double? translationSpeed, String? forwardAnimation});
|
||||
|
||||
///
|
||||
/// Make [collidableEntity] collidable.
|
||||
/// At the moment, this is only relevant when controlling a different entity's transform.
|
||||
/// If there is a collision between the controlled entity and [collidableEntity], the transform will not be updated.
|
||||
///
|
||||
Future addCollisionComponent(FilamentEntity collidableEntity);
|
||||
}
|
||||
|
||||
@@ -1358,4 +1358,13 @@ class FilamentControllerFFI extends FilamentController {
|
||||
_keyboardListener = HardwareKeyboardListener(transformController);
|
||||
return transformController;
|
||||
}
|
||||
|
||||
@override
|
||||
Future addCollisionComponent(FilamentEntity entity) async {
|
||||
if (_assetManager == null) {
|
||||
throw Exception("AssetManager must be non-null");
|
||||
}
|
||||
|
||||
add_collision_component(_assetManager!, entity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -828,6 +828,13 @@ external void flutter_filament_free(
|
||||
ffi.Pointer<ffi.Void> ptr,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>, EntityId)>(
|
||||
symbol: 'add_collision_component', assetId: 'flutter_filament_plugin')
|
||||
external void add_collision_component(
|
||||
ffi.Pointer<ffi.Void> assetManager,
|
||||
int entityId,
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Pointer<ffi.Void> Function(
|
||||
ffi.Pointer<ffi.Void>,
|
||||
|
||||
Reference in New Issue
Block a user