@@ -23,12 +23,12 @@ import type {
23
23
} from './types' ;
24
24
import { quaternionToRapierQuaternion , vector3ToRapierVector } from './utils' ;
25
25
26
- function injectImpulseJoint < TJoinType extends ImpulseJoint > (
26
+ function impulseJoint < TJoinType extends ImpulseJoint > (
27
27
bodyA : ElementRef < RigidBody > | RigidBody | ( ( ) => ElementRef < RigidBody > | RigidBody | undefined | null ) ,
28
28
bodyB : ElementRef < RigidBody > | RigidBody | ( ( ) => ElementRef < RigidBody > | RigidBody | undefined | null ) ,
29
29
{ injector, data } : { injector ?: Injector ; data : JointData | ( ( ) => JointData | null ) } ,
30
30
) {
31
- return assertInjector ( injectImpulseJoint , injector , ( ) => {
31
+ return assertInjector ( impulseJoint , injector , ( ) => {
32
32
const physics = inject ( NgtrPhysics ) ;
33
33
34
34
const newJoint = computed < TJoinType | null > ( ( ) => {
@@ -86,7 +86,7 @@ function createJoint<TJointParams, TJoinType extends ImpulseJoint>(
86
86
return jointDataFn ( rapier , untracked ( dataFn ) ) ;
87
87
} ) ;
88
88
89
- return injectImpulseJoint < TJoinType > ( bodyA , bodyB , { injector, data : jointData } ) ;
89
+ return impulseJoint < TJoinType > ( bodyA , bodyB , { injector, data : jointData } ) ;
90
90
} ) ;
91
91
} ;
92
92
}
@@ -98,14 +98,19 @@ function createJoint<TJointParams, TJoinType extends ImpulseJoint>(
98
98
*
99
99
* @category Hooks - Joints
100
100
*/
101
- export const injectFixedJoint = createJoint < NgtrFixedJointParams , FixedImpulseJoint > ( ( rapier , data ) =>
101
+ export const fixedJoint = createJoint < NgtrFixedJointParams , FixedImpulseJoint > ( ( rapier , data ) =>
102
102
rapier . JointData . fixed (
103
103
vector3ToRapierVector ( data . body1Anchor ) ,
104
104
quaternionToRapierQuaternion ( data . body1LocalFrame ) ,
105
105
vector3ToRapierVector ( data . body2Anchor ) ,
106
106
quaternionToRapierQuaternion ( data . body2LocalFrame ) ,
107
107
) ,
108
108
) ;
109
+ /**
110
+ * @deprecated Use `fixedJoint` instead. Will be removed in v5.0.0
111
+ * @since v4.0.0
112
+ */
113
+ export const injectFixedJoint = fixedJoint ;
109
114
110
115
/**
111
116
* The spherical joint ensures that two points on the local-spaces of two rigid-bodies always coincide (it prevents any relative
@@ -115,9 +120,14 @@ export const injectFixedJoint = createJoint<NgtrFixedJointParams, FixedImpulseJo
115
120
*
116
121
* @category Hooks - Joints
117
122
*/
118
- export const injectSphericalJoint = createJoint < NgtrSphericalJointParams , SphericalImpulseJoint > ( ( rapier , data ) =>
123
+ export const sphericalJoint = createJoint < NgtrSphericalJointParams , SphericalImpulseJoint > ( ( rapier , data ) =>
119
124
rapier . JointData . spherical ( vector3ToRapierVector ( data . body1Anchor ) , vector3ToRapierVector ( data . body2Anchor ) ) ,
120
125
) ;
126
+ /**
127
+ * @deprecated Use `sphericalJoint` instead. Will be removed in v5.0.0
128
+ * @since v4.0.0
129
+ */
130
+ export const injectSphericalJoint = sphericalJoint ;
121
131
122
132
/**
123
133
* The revolute joint prevents any relative movement between two rigid-bodies, except for relative
@@ -126,7 +136,7 @@ export const injectSphericalJoint = createJoint<NgtrSphericalJointParams, Spheri
126
136
*
127
137
* @category Hooks - Joints
128
138
*/
129
- export const injectRevoluteJoint = createJoint < NgtrRevoluteJointParams , RevoluteImpulseJoint > ( ( rapier , data ) => {
139
+ export const revoluteJoint = createJoint < NgtrRevoluteJointParams , RevoluteImpulseJoint > ( ( rapier , data ) => {
130
140
const jointData = rapier . JointData . revolute (
131
141
vector3ToRapierVector ( data . body1Anchor ) ,
132
142
vector3ToRapierVector ( data . body2Anchor ) ,
@@ -140,6 +150,11 @@ export const injectRevoluteJoint = createJoint<NgtrRevoluteJointParams, Revolute
140
150
141
151
return jointData ;
142
152
} ) ;
153
+ /**
154
+ * @deprecated Use `revoluteJoint` instead. Will be removed in v5.0.0
155
+ * @since v4.0.0
156
+ */
157
+ export const injectRevoluteJoint = revoluteJoint ;
143
158
144
159
/**
145
160
* The prismatic joint prevents any relative movement between two rigid-bodies, except for relative translations along one axis.
@@ -148,7 +163,7 @@ export const injectRevoluteJoint = createJoint<NgtrRevoluteJointParams, Revolute
148
163
*
149
164
* @category Hooks - Joints
150
165
*/
151
- export const injectPrismaticJoint = createJoint < NgtrPrismaticJointParams , PrismaticImpulseJoint > ( ( rapier , data ) => {
166
+ export const prismaticJoint = createJoint < NgtrPrismaticJointParams , PrismaticImpulseJoint > ( ( rapier , data ) => {
152
167
const jointData = rapier . JointData . prismatic (
153
168
vector3ToRapierVector ( data . body1Anchor ) ,
154
169
vector3ToRapierVector ( data . body2Anchor ) ,
@@ -162,24 +177,34 @@ export const injectPrismaticJoint = createJoint<NgtrPrismaticJointParams, Prisma
162
177
163
178
return jointData ;
164
179
} ) ;
180
+ /**
181
+ * @deprecated Use `prismaticJoint` instead. Will be removed in v5.0.0
182
+ * @since v4.0.0
183
+ */
184
+ export const injectPrismaticJoint = prismaticJoint ;
165
185
166
186
/**
167
187
* The rope joint limits the max distance between two bodies.
168
188
* @category Hooks - Joints
169
189
*/
170
- export const injectRopeJoint = createJoint < NgtrRopeJointParams , RopeImpulseJoint > ( ( rapier , data ) =>
190
+ export const ropeJoint = createJoint < NgtrRopeJointParams , RopeImpulseJoint > ( ( rapier , data ) =>
171
191
rapier . JointData . rope (
172
192
data . length ,
173
193
vector3ToRapierVector ( data . body1Anchor ) ,
174
194
vector3ToRapierVector ( data . body2Anchor ) ,
175
195
) ,
176
196
) ;
197
+ /**
198
+ * @deprecated Use `ropeJoint` instead. Will be removed in v5.0.0
199
+ * @since v4.0.0
200
+ */
201
+ export const injectRopeJoint = ropeJoint ;
177
202
178
203
/**
179
204
* The spring joint applies a force proportional to the distance between two objects.
180
205
* @category Hooks - Joints
181
206
*/
182
- export const injectSpringJoint = createJoint < NgtrSpringJointParams , SpringImpulseJoint > ( ( rapier , data ) => {
207
+ export const springJoint = createJoint < NgtrSpringJointParams , SpringImpulseJoint > ( ( rapier , data ) => {
183
208
return rapier . JointData . spring (
184
209
data . restLength ,
185
210
data . stiffness ,
@@ -188,3 +213,8 @@ export const injectSpringJoint = createJoint<NgtrSpringJointParams, SpringImpuls
188
213
vector3ToRapierVector ( data . body2Anchor ) ,
189
214
) ;
190
215
} ) ;
216
+ /**
217
+ * @deprecated Use `springJoint` instead. Will be removed in v5.0.0
218
+ * @since v4.0.0
219
+ */
220
+ export const injectSpringJoint = springJoint ;
0 commit comments