objc2_scene_kit/generated/
SCNPhysicsBody.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12/// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnphysicsbodytype?language=objc)
13// NS_ENUM
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct SCNPhysicsBodyType(pub NSInteger);
17impl SCNPhysicsBodyType {
18    #[doc(alias = "SCNPhysicsBodyTypeStatic")]
19    pub const Static: Self = Self(0);
20    #[doc(alias = "SCNPhysicsBodyTypeDynamic")]
21    pub const Dynamic: Self = Self(1);
22    #[doc(alias = "SCNPhysicsBodyTypeKinematic")]
23    pub const Kinematic: Self = Self(2);
24}
25
26unsafe impl Encode for SCNPhysicsBodyType {
27    const ENCODING: Encoding = NSInteger::ENCODING;
28}
29
30unsafe impl RefEncode for SCNPhysicsBodyType {
31    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
32}
33
34/// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnphysicscollisioncategory?language=objc)
35// NS_OPTIONS
36#[repr(transparent)]
37#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
38pub struct SCNPhysicsCollisionCategory(pub NSUInteger);
39bitflags::bitflags! {
40    impl SCNPhysicsCollisionCategory: NSUInteger {
41        #[doc(alias = "SCNPhysicsCollisionCategoryDefault")]
42        const Default = 1<<0;
43        #[doc(alias = "SCNPhysicsCollisionCategoryStatic")]
44        const Static = 1<<1;
45        #[doc(alias = "SCNPhysicsCollisionCategoryAll")]
46        const All = !0;
47    }
48}
49
50unsafe impl Encode for SCNPhysicsCollisionCategory {
51    const ENCODING: Encoding = NSUInteger::ENCODING;
52}
53
54unsafe impl RefEncode for SCNPhysicsCollisionCategory {
55    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
56}
57
58extern_class!(
59    /// The SCNPhysicsBody class describes the physics properties (such as mass, friction...) of a node.
60    ///
61    /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnphysicsbody?language=objc)
62    #[unsafe(super(NSObject))]
63    #[derive(Debug, PartialEq, Eq, Hash)]
64    pub struct SCNPhysicsBody;
65);
66
67extern_conformance!(
68    unsafe impl NSCoding for SCNPhysicsBody {}
69);
70
71extern_conformance!(
72    unsafe impl NSCopying for SCNPhysicsBody {}
73);
74
75unsafe impl CopyingHelper for SCNPhysicsBody {
76    type Result = Self;
77}
78
79extern_conformance!(
80    unsafe impl NSObjectProtocol for SCNPhysicsBody {}
81);
82
83extern_conformance!(
84    unsafe impl NSSecureCoding for SCNPhysicsBody {}
85);
86
87impl SCNPhysicsBody {
88    extern_methods!(
89        #[unsafe(method(staticBody))]
90        #[unsafe(method_family = none)]
91        pub unsafe fn staticBody() -> Retained<Self>;
92
93        #[unsafe(method(dynamicBody))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn dynamicBody() -> Retained<Self>;
96
97        #[unsafe(method(kinematicBody))]
98        #[unsafe(method_family = none)]
99        pub unsafe fn kinematicBody() -> Retained<Self>;
100
101        #[cfg(feature = "SCNPhysicsShape")]
102        #[unsafe(method(bodyWithType:shape:))]
103        #[unsafe(method_family = none)]
104        pub unsafe fn bodyWithType_shape(
105            r#type: SCNPhysicsBodyType,
106            shape: Option<&SCNPhysicsShape>,
107        ) -> Retained<Self>;
108
109        #[unsafe(method(type))]
110        #[unsafe(method_family = none)]
111        pub unsafe fn r#type(&self) -> SCNPhysicsBodyType;
112
113        /// Setter for [`type`][Self::type].
114        #[unsafe(method(setType:))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn setType(&self, r#type: SCNPhysicsBodyType);
117
118        #[cfg(feature = "objc2-core-foundation")]
119        #[unsafe(method(mass))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn mass(&self) -> CGFloat;
122
123        #[cfg(feature = "objc2-core-foundation")]
124        /// Setter for [`mass`][Self::mass].
125        #[unsafe(method(setMass:))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn setMass(&self, mass: CGFloat);
128
129        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
130        #[unsafe(method(momentOfInertia))]
131        #[unsafe(method_family = none)]
132        pub unsafe fn momentOfInertia(&self) -> SCNVector3;
133
134        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
135        /// Setter for [`momentOfInertia`][Self::momentOfInertia].
136        #[unsafe(method(setMomentOfInertia:))]
137        #[unsafe(method_family = none)]
138        pub unsafe fn setMomentOfInertia(&self, moment_of_inertia: SCNVector3);
139
140        #[unsafe(method(usesDefaultMomentOfInertia))]
141        #[unsafe(method_family = none)]
142        pub unsafe fn usesDefaultMomentOfInertia(&self) -> bool;
143
144        /// Setter for [`usesDefaultMomentOfInertia`][Self::usesDefaultMomentOfInertia].
145        #[unsafe(method(setUsesDefaultMomentOfInertia:))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn setUsesDefaultMomentOfInertia(&self, uses_default_moment_of_inertia: bool);
148
149        #[cfg(feature = "objc2-core-foundation")]
150        #[unsafe(method(charge))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn charge(&self) -> CGFloat;
153
154        #[cfg(feature = "objc2-core-foundation")]
155        /// Setter for [`charge`][Self::charge].
156        #[unsafe(method(setCharge:))]
157        #[unsafe(method_family = none)]
158        pub unsafe fn setCharge(&self, charge: CGFloat);
159
160        #[cfg(feature = "objc2-core-foundation")]
161        #[unsafe(method(friction))]
162        #[unsafe(method_family = none)]
163        pub unsafe fn friction(&self) -> CGFloat;
164
165        #[cfg(feature = "objc2-core-foundation")]
166        /// Setter for [`friction`][Self::friction].
167        #[unsafe(method(setFriction:))]
168        #[unsafe(method_family = none)]
169        pub unsafe fn setFriction(&self, friction: CGFloat);
170
171        #[cfg(feature = "objc2-core-foundation")]
172        #[unsafe(method(restitution))]
173        #[unsafe(method_family = none)]
174        pub unsafe fn restitution(&self) -> CGFloat;
175
176        #[cfg(feature = "objc2-core-foundation")]
177        /// Setter for [`restitution`][Self::restitution].
178        #[unsafe(method(setRestitution:))]
179        #[unsafe(method_family = none)]
180        pub unsafe fn setRestitution(&self, restitution: CGFloat);
181
182        #[cfg(feature = "objc2-core-foundation")]
183        #[unsafe(method(rollingFriction))]
184        #[unsafe(method_family = none)]
185        pub unsafe fn rollingFriction(&self) -> CGFloat;
186
187        #[cfg(feature = "objc2-core-foundation")]
188        /// Setter for [`rollingFriction`][Self::rollingFriction].
189        #[unsafe(method(setRollingFriction:))]
190        #[unsafe(method_family = none)]
191        pub unsafe fn setRollingFriction(&self, rolling_friction: CGFloat);
192
193        #[cfg(feature = "SCNPhysicsShape")]
194        #[unsafe(method(physicsShape))]
195        #[unsafe(method_family = none)]
196        pub unsafe fn physicsShape(&self) -> Option<Retained<SCNPhysicsShape>>;
197
198        #[cfg(feature = "SCNPhysicsShape")]
199        /// Setter for [`physicsShape`][Self::physicsShape].
200        #[unsafe(method(setPhysicsShape:))]
201        #[unsafe(method_family = none)]
202        pub unsafe fn setPhysicsShape(&self, physics_shape: Option<&SCNPhysicsShape>);
203
204        #[unsafe(method(isResting))]
205        #[unsafe(method_family = none)]
206        pub unsafe fn isResting(&self) -> bool;
207
208        #[unsafe(method(allowsResting))]
209        #[unsafe(method_family = none)]
210        pub unsafe fn allowsResting(&self) -> bool;
211
212        /// Setter for [`allowsResting`][Self::allowsResting].
213        #[unsafe(method(setAllowsResting:))]
214        #[unsafe(method_family = none)]
215        pub unsafe fn setAllowsResting(&self, allows_resting: bool);
216
217        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
218        #[unsafe(method(velocity))]
219        #[unsafe(method_family = none)]
220        pub unsafe fn velocity(&self) -> SCNVector3;
221
222        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
223        /// Setter for [`velocity`][Self::velocity].
224        #[unsafe(method(setVelocity:))]
225        #[unsafe(method_family = none)]
226        pub unsafe fn setVelocity(&self, velocity: SCNVector3);
227
228        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
229        #[unsafe(method(angularVelocity))]
230        #[unsafe(method_family = none)]
231        pub unsafe fn angularVelocity(&self) -> SCNVector4;
232
233        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
234        /// Setter for [`angularVelocity`][Self::angularVelocity].
235        #[unsafe(method(setAngularVelocity:))]
236        #[unsafe(method_family = none)]
237        pub unsafe fn setAngularVelocity(&self, angular_velocity: SCNVector4);
238
239        #[cfg(feature = "objc2-core-foundation")]
240        #[unsafe(method(damping))]
241        #[unsafe(method_family = none)]
242        pub unsafe fn damping(&self) -> CGFloat;
243
244        #[cfg(feature = "objc2-core-foundation")]
245        /// Setter for [`damping`][Self::damping].
246        #[unsafe(method(setDamping:))]
247        #[unsafe(method_family = none)]
248        pub unsafe fn setDamping(&self, damping: CGFloat);
249
250        #[cfg(feature = "objc2-core-foundation")]
251        #[unsafe(method(angularDamping))]
252        #[unsafe(method_family = none)]
253        pub unsafe fn angularDamping(&self) -> CGFloat;
254
255        #[cfg(feature = "objc2-core-foundation")]
256        /// Setter for [`angularDamping`][Self::angularDamping].
257        #[unsafe(method(setAngularDamping:))]
258        #[unsafe(method_family = none)]
259        pub unsafe fn setAngularDamping(&self, angular_damping: CGFloat);
260
261        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
262        #[unsafe(method(velocityFactor))]
263        #[unsafe(method_family = none)]
264        pub unsafe fn velocityFactor(&self) -> SCNVector3;
265
266        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
267        /// Setter for [`velocityFactor`][Self::velocityFactor].
268        #[unsafe(method(setVelocityFactor:))]
269        #[unsafe(method_family = none)]
270        pub unsafe fn setVelocityFactor(&self, velocity_factor: SCNVector3);
271
272        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
273        #[unsafe(method(angularVelocityFactor))]
274        #[unsafe(method_family = none)]
275        pub unsafe fn angularVelocityFactor(&self) -> SCNVector3;
276
277        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
278        /// Setter for [`angularVelocityFactor`][Self::angularVelocityFactor].
279        #[unsafe(method(setAngularVelocityFactor:))]
280        #[unsafe(method_family = none)]
281        pub unsafe fn setAngularVelocityFactor(&self, angular_velocity_factor: SCNVector3);
282
283        #[unsafe(method(categoryBitMask))]
284        #[unsafe(method_family = none)]
285        pub unsafe fn categoryBitMask(&self) -> NSUInteger;
286
287        /// Setter for [`categoryBitMask`][Self::categoryBitMask].
288        #[unsafe(method(setCategoryBitMask:))]
289        #[unsafe(method_family = none)]
290        pub unsafe fn setCategoryBitMask(&self, category_bit_mask: NSUInteger);
291
292        #[unsafe(method(collisionBitMask))]
293        #[unsafe(method_family = none)]
294        pub unsafe fn collisionBitMask(&self) -> NSUInteger;
295
296        /// Setter for [`collisionBitMask`][Self::collisionBitMask].
297        #[unsafe(method(setCollisionBitMask:))]
298        #[unsafe(method_family = none)]
299        pub unsafe fn setCollisionBitMask(&self, collision_bit_mask: NSUInteger);
300
301        #[unsafe(method(contactTestBitMask))]
302        #[unsafe(method_family = none)]
303        pub unsafe fn contactTestBitMask(&self) -> NSUInteger;
304
305        /// Setter for [`contactTestBitMask`][Self::contactTestBitMask].
306        #[unsafe(method(setContactTestBitMask:))]
307        #[unsafe(method_family = none)]
308        pub unsafe fn setContactTestBitMask(&self, contact_test_bit_mask: NSUInteger);
309
310        #[unsafe(method(isAffectedByGravity))]
311        #[unsafe(method_family = none)]
312        pub unsafe fn isAffectedByGravity(&self) -> bool;
313
314        /// Setter for [`isAffectedByGravity`][Self::isAffectedByGravity].
315        #[unsafe(method(setAffectedByGravity:))]
316        #[unsafe(method_family = none)]
317        pub unsafe fn setAffectedByGravity(&self, affected_by_gravity: bool);
318
319        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
320        #[unsafe(method(applyForce:impulse:))]
321        #[unsafe(method_family = none)]
322        pub unsafe fn applyForce_impulse(&self, direction: SCNVector3, impulse: bool);
323
324        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
325        #[unsafe(method(applyForce:atPosition:impulse:))]
326        #[unsafe(method_family = none)]
327        pub unsafe fn applyForce_atPosition_impulse(
328            &self,
329            direction: SCNVector3,
330            position: SCNVector3,
331            impulse: bool,
332        );
333
334        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
335        #[unsafe(method(applyTorque:impulse:))]
336        #[unsafe(method_family = none)]
337        pub unsafe fn applyTorque_impulse(&self, torque: SCNVector4, impulse: bool);
338
339        #[unsafe(method(clearAllForces))]
340        #[unsafe(method_family = none)]
341        pub unsafe fn clearAllForces(&self);
342
343        #[unsafe(method(resetTransform))]
344        #[unsafe(method_family = none)]
345        pub unsafe fn resetTransform(&self);
346
347        #[unsafe(method(setResting:))]
348        #[unsafe(method_family = none)]
349        pub unsafe fn setResting(&self, resting: bool);
350
351        #[cfg(feature = "objc2-core-foundation")]
352        #[unsafe(method(continuousCollisionDetectionThreshold))]
353        #[unsafe(method_family = none)]
354        pub unsafe fn continuousCollisionDetectionThreshold(&self) -> CGFloat;
355
356        #[cfg(feature = "objc2-core-foundation")]
357        /// Setter for [`continuousCollisionDetectionThreshold`][Self::continuousCollisionDetectionThreshold].
358        #[unsafe(method(setContinuousCollisionDetectionThreshold:))]
359        #[unsafe(method_family = none)]
360        pub unsafe fn setContinuousCollisionDetectionThreshold(
361            &self,
362            continuous_collision_detection_threshold: CGFloat,
363        );
364
365        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
366        #[unsafe(method(centerOfMassOffset))]
367        #[unsafe(method_family = none)]
368        pub unsafe fn centerOfMassOffset(&self) -> SCNVector3;
369
370        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
371        /// Setter for [`centerOfMassOffset`][Self::centerOfMassOffset].
372        #[unsafe(method(setCenterOfMassOffset:))]
373        #[unsafe(method_family = none)]
374        pub unsafe fn setCenterOfMassOffset(&self, center_of_mass_offset: SCNVector3);
375
376        #[cfg(feature = "objc2-core-foundation")]
377        #[unsafe(method(linearRestingThreshold))]
378        #[unsafe(method_family = none)]
379        pub unsafe fn linearRestingThreshold(&self) -> CGFloat;
380
381        #[cfg(feature = "objc2-core-foundation")]
382        /// Setter for [`linearRestingThreshold`][Self::linearRestingThreshold].
383        #[unsafe(method(setLinearRestingThreshold:))]
384        #[unsafe(method_family = none)]
385        pub unsafe fn setLinearRestingThreshold(&self, linear_resting_threshold: CGFloat);
386
387        #[cfg(feature = "objc2-core-foundation")]
388        #[unsafe(method(angularRestingThreshold))]
389        #[unsafe(method_family = none)]
390        pub unsafe fn angularRestingThreshold(&self) -> CGFloat;
391
392        #[cfg(feature = "objc2-core-foundation")]
393        /// Setter for [`angularRestingThreshold`][Self::angularRestingThreshold].
394        #[unsafe(method(setAngularRestingThreshold:))]
395        #[unsafe(method_family = none)]
396        pub unsafe fn setAngularRestingThreshold(&self, angular_resting_threshold: CGFloat);
397    );
398}
399
400/// Methods declared on superclass `NSObject`.
401impl SCNPhysicsBody {
402    extern_methods!(
403        #[unsafe(method(init))]
404        #[unsafe(method_family = init)]
405        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
406
407        #[unsafe(method(new))]
408        #[unsafe(method_family = new)]
409        pub unsafe fn new() -> Retained<Self>;
410    );
411}