add testCollisions method for manual collision checking
This commit is contained in:
@@ -6,6 +6,7 @@ import 'package:flutter/widgets.dart';
|
||||
|
||||
import 'package:flutter_filament/animations/animation_data.dart';
|
||||
import 'package:flutter_filament/entities/entity_transform_controller.dart';
|
||||
import 'package:flutter_filament/generated_bindings.dart';
|
||||
import 'package:vector_math/vector_math_64.dart';
|
||||
|
||||
// a handle that can be safely passed back to the rendering layer to manipulate an Entity
|
||||
@@ -594,16 +595,6 @@ abstract class FilamentController {
|
||||
{void Function(int entityId1, int entityId2)? callback,
|
||||
bool affectsCollingTransform = false});
|
||||
|
||||
///
|
||||
/// Make [entity] collidable, without affecting its transform.
|
||||
///
|
||||
Future markNonTransformableCollidable(FilamentEntity entity);
|
||||
|
||||
///
|
||||
/// Make [entity] no longer collidable.
|
||||
///
|
||||
Future unmarkNonTransformableCollidable(FilamentEntity entity);
|
||||
|
||||
///
|
||||
/// Creates a (renderable) entity with the specified geometry and adds to the scene.
|
||||
///
|
||||
@@ -614,4 +605,10 @@ abstract class FilamentController {
|
||||
/// Sets the parent transform of [child] to the transform of [parent].
|
||||
///
|
||||
Future setParent(FilamentEntity child, FilamentEntity parent);
|
||||
|
||||
///
|
||||
/// Test all collidable entities against this entity to see if any have collided.
|
||||
/// This method returns void; the relevant callback passed to [addCollisionComponent] will be fired if a collision is detected.
|
||||
///
|
||||
Future testCollisions(FilamentEntity entity);
|
||||
}
|
||||
|
||||
@@ -1437,16 +1437,6 @@ class FilamentControllerFFI extends FilamentController {
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future markNonTransformableCollidable(FilamentEntity entity) async {
|
||||
mark_nontransformable_collidable(_sceneManager!, entity);
|
||||
}
|
||||
|
||||
@override
|
||||
Future unmarkNonTransformableCollidable(FilamentEntity entity) async {
|
||||
unmark_nontransformable_collidable(_sceneManager!, entity);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<FilamentEntity> createGeometry(
|
||||
List<double> vertices, List<int> indices, String? materialPath) async {
|
||||
@@ -1489,4 +1479,9 @@ class FilamentControllerFFI extends FilamentController {
|
||||
}
|
||||
set_parent(_sceneManager!, child, parent);
|
||||
}
|
||||
|
||||
@override
|
||||
Future testCollisions(FilamentEntity entity) async {
|
||||
test_collisions(_sceneManager!, entity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -891,22 +891,6 @@ external void add_collision_component(
|
||||
bool affectsCollidingTransform,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>, EntityId)>(
|
||||
symbol: 'mark_nontransformable_collidable',
|
||||
assetId: 'flutter_filament_plugin')
|
||||
external void mark_nontransformable_collidable(
|
||||
ffi.Pointer<ffi.Void> sceneManager,
|
||||
int entityId,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>, EntityId)>(
|
||||
symbol: 'unmark_nontransformable_collidable',
|
||||
assetId: 'flutter_filament_plugin')
|
||||
external void unmark_nontransformable_collidable(
|
||||
ffi.Pointer<ffi.Void> sceneManager,
|
||||
int entityId,
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
EntityId Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Float>,
|
||||
ffi.Int, ffi.Pointer<ffi.Uint16>, ffi.Int, ffi.Pointer<ffi.Char>)>(
|
||||
@@ -928,6 +912,13 @@ external void set_parent(
|
||||
int parent,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>, EntityId)>(
|
||||
symbol: 'test_collisions', assetId: 'flutter_filament_plugin')
|
||||
external void test_collisions(
|
||||
ffi.Pointer<ffi.Void> sceneManager,
|
||||
int entity,
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Pointer<ffi.Void> Function(
|
||||
ffi.Pointer<ffi.Void>,
|
||||
|
||||
Reference in New Issue
Block a user