@@ -16,10 +16,10 @@ import {
1616} from '@angular/core' ;
1717import { takeUntilDestroyed } from '@angular/core/rxjs-interop' ;
1818import { CylinderArgs , Triplet } from '@pmndrs/cannon-worker-api' ;
19- import { NgtArgs , injectBeforeRender , injectStore } from 'angular-three' ;
19+ import { NgtArgs , beforeRender , injectStore } from 'angular-three' ;
2020import { NgtcPhysics } from 'angular-three-cannon' ;
21- import { injectBox , injectCylinder , injectSphere } from 'angular-three-cannon/body' ;
22- import { injectConeTwist } from 'angular-three-cannon/constraint' ;
21+ import { box , cylinder , sphere } from 'angular-three-cannon/body' ;
22+ import { coneTwist } from 'angular-three-cannon/constraint' ;
2323import { Color , ColorRepresentation , Mesh , Object3D } from 'three' ;
2424
2525interface Handle {
@@ -63,15 +63,12 @@ export class ChainLink {
6363 protected mesh = viewChild . required < ElementRef < Mesh > > ( 'mesh' ) ;
6464
6565 constructor ( ) {
66- injectCylinder (
67- ( ) => ( { mass : 1 , args : this . args ( ) , linearDamping : 0.8 , position : this . position ( ) } ) ,
68- this . mesh ,
69- ) ;
66+ cylinder ( ( ) => ( { mass : 1 , args : this . args ( ) , linearDamping : 0.8 , position : this . position ( ) } ) , this . mesh ) ;
7067
7168 const injector = inject ( Injector ) ;
7269 // NOTE: we want to run this in afterNextRender because we want the input to resolve
7370 afterNextRender ( ( ) => {
74- injectConeTwist ( this . parent . ref , this . mesh , {
71+ coneTwist ( this . parent . ref , this . mesh , {
7572 injector,
7673 options : {
7774 angle : Math . PI / 8 ,
@@ -143,9 +140,9 @@ export class PointerHandle {
143140 protected mesh = viewChild . required < ElementRef < Mesh > > ( 'mesh' ) ;
144141
145142 constructor ( ) {
146- const boxApi = injectBox ( ( ) => ( { args : this . args , position : this . position , type : 'Kinematic' } ) , this . mesh ) ;
143+ const boxApi = box ( ( ) => ( { args : this . args , position : this . position , type : 'Kinematic' } ) , this . mesh ) ;
147144
148- injectBeforeRender ( ( { pointer : { x, y } , viewport : { width, height } } ) => {
145+ beforeRender ( ( { pointer : { x, y } , viewport : { width, height } } ) => {
149146 boxApi ( ) ?. position . set ( ( x * width ) / 2 , ( y * height ) / 2 , 0 ) ;
150147 } ) ;
151148 }
@@ -173,7 +170,7 @@ export class StaticHandle {
173170 protected mesh = viewChild . required < ElementRef < Mesh > > ( 'mesh' ) ;
174171
175172 constructor ( ) {
176- injectSphere ( ( ) => ( { args : [ 1.5 ] , position : this . position ( ) , type : 'Static' } ) , this . mesh ) ;
173+ sphere ( ( ) => ( { args : [ 1.5 ] , position : this . position ( ) , type : 'Static' } ) , this . mesh ) ;
177174 }
178175}
179176
0 commit comments