Skip to content

Commit ebffbe6

Browse files
committed
added helper methods to graph to borrow nodes and do ray casting
1 parent 4df5ca3 commit ebffbe6

File tree

1 file changed

+35
-0
lines changed
  • fyrox-impl/src/scene/graph

1 file changed

+35
-0
lines changed

fyrox-impl/src/scene/graph/mod.rs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,41 @@ impl Graph {
360360
}
361361
}
362362

363+
/// Begins multi-borrowing and gives access to the 3D physics world at the same time. The physics
364+
/// world could be used to perform shape or ray casting while having the ability to modify scene
365+
/// nodes.
366+
pub fn begin_multi_borrow_with_physics_3d(
367+
&mut self,
368+
) -> (MultiBorrowContext<Node, NodeContainer>, &PhysicsWorld) {
369+
(self.pool.begin_multi_borrow(), &self.physics)
370+
}
371+
372+
/// Begins multi-borrowing and gives access to the 2D physics world at the same time. The physics
373+
/// world could be used to perform shape or ray casting while having the ability to modify scene
374+
/// nodes.
375+
pub fn begin_multi_borrow_with_physics_2d(
376+
&mut self,
377+
) -> (MultiBorrowContext<Node, NodeContainer>, &PhysicsWorld) {
378+
(self.pool.begin_multi_borrow(), &mut self.physics)
379+
}
380+
381+
/// Begins multi-borrowing and gives access to the 3D and 2D physics world at the same time. The
382+
/// physics world could be used to perform shape or ray casting while having the ability to modify
383+
/// scene nodes.
384+
pub fn begin_multi_borrow_with_physics(
385+
&mut self,
386+
) -> (
387+
MultiBorrowContext<Node, NodeContainer>,
388+
&PhysicsWorld,
389+
&dim2::physics::PhysicsWorld,
390+
) {
391+
(
392+
self.pool.begin_multi_borrow(),
393+
&self.physics,
394+
&self.physics2d,
395+
)
396+
}
397+
363398
/// Creates a new graph using a hierarchy of nodes specified by the `root`.
364399
pub fn from_hierarchy(root: Handle<Node>, other_graph: &Self) -> Self {
365400
let mut graph = Self::default();

0 commit comments

Comments
 (0)