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
67unsafe impl NSCoding for SCNPhysicsBody {}
68
69unsafe impl NSCopying for SCNPhysicsBody {}
70
71unsafe impl CopyingHelper for SCNPhysicsBody {
72    type Result = Self;
73}
74
75unsafe impl NSObjectProtocol for SCNPhysicsBody {}
76
77unsafe impl NSSecureCoding for SCNPhysicsBody {}
78
79impl SCNPhysicsBody {
80    extern_methods!(
81        #[unsafe(method(staticBody))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn staticBody() -> Retained<Self>;
84
85        #[unsafe(method(dynamicBody))]
86        #[unsafe(method_family = none)]
87        pub unsafe fn dynamicBody() -> Retained<Self>;
88
89        #[unsafe(method(kinematicBody))]
90        #[unsafe(method_family = none)]
91        pub unsafe fn kinematicBody() -> Retained<Self>;
92
93        #[cfg(feature = "SCNPhysicsShape")]
94        #[unsafe(method(bodyWithType:shape:))]
95        #[unsafe(method_family = none)]
96        pub unsafe fn bodyWithType_shape(
97            r#type: SCNPhysicsBodyType,
98            shape: Option<&SCNPhysicsShape>,
99        ) -> Retained<Self>;
100
101        #[unsafe(method(type))]
102        #[unsafe(method_family = none)]
103        pub unsafe fn r#type(&self) -> SCNPhysicsBodyType;
104
105        /// Setter for [`type`][Self::type].
106        #[unsafe(method(setType:))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn setType(&self, r#type: SCNPhysicsBodyType);
109
110        #[cfg(feature = "objc2-core-foundation")]
111        #[unsafe(method(mass))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn mass(&self) -> CGFloat;
114
115        #[cfg(feature = "objc2-core-foundation")]
116        /// Setter for [`mass`][Self::mass].
117        #[unsafe(method(setMass:))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn setMass(&self, mass: CGFloat);
120
121        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
122        #[unsafe(method(momentOfInertia))]
123        #[unsafe(method_family = none)]
124        pub unsafe fn momentOfInertia(&self) -> SCNVector3;
125
126        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
127        /// Setter for [`momentOfInertia`][Self::momentOfInertia].
128        #[unsafe(method(setMomentOfInertia:))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn setMomentOfInertia(&self, moment_of_inertia: SCNVector3);
131
132        #[unsafe(method(usesDefaultMomentOfInertia))]
133        #[unsafe(method_family = none)]
134        pub unsafe fn usesDefaultMomentOfInertia(&self) -> bool;
135
136        /// Setter for [`usesDefaultMomentOfInertia`][Self::usesDefaultMomentOfInertia].
137        #[unsafe(method(setUsesDefaultMomentOfInertia:))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn setUsesDefaultMomentOfInertia(&self, uses_default_moment_of_inertia: bool);
140
141        #[cfg(feature = "objc2-core-foundation")]
142        #[unsafe(method(charge))]
143        #[unsafe(method_family = none)]
144        pub unsafe fn charge(&self) -> CGFloat;
145
146        #[cfg(feature = "objc2-core-foundation")]
147        /// Setter for [`charge`][Self::charge].
148        #[unsafe(method(setCharge:))]
149        #[unsafe(method_family = none)]
150        pub unsafe fn setCharge(&self, charge: CGFloat);
151
152        #[cfg(feature = "objc2-core-foundation")]
153        #[unsafe(method(friction))]
154        #[unsafe(method_family = none)]
155        pub unsafe fn friction(&self) -> CGFloat;
156
157        #[cfg(feature = "objc2-core-foundation")]
158        /// Setter for [`friction`][Self::friction].
159        #[unsafe(method(setFriction:))]
160        #[unsafe(method_family = none)]
161        pub unsafe fn setFriction(&self, friction: CGFloat);
162
163        #[cfg(feature = "objc2-core-foundation")]
164        #[unsafe(method(restitution))]
165        #[unsafe(method_family = none)]
166        pub unsafe fn restitution(&self) -> CGFloat;
167
168        #[cfg(feature = "objc2-core-foundation")]
169        /// Setter for [`restitution`][Self::restitution].
170        #[unsafe(method(setRestitution:))]
171        #[unsafe(method_family = none)]
172        pub unsafe fn setRestitution(&self, restitution: CGFloat);
173
174        #[cfg(feature = "objc2-core-foundation")]
175        #[unsafe(method(rollingFriction))]
176        #[unsafe(method_family = none)]
177        pub unsafe fn rollingFriction(&self) -> CGFloat;
178
179        #[cfg(feature = "objc2-core-foundation")]
180        /// Setter for [`rollingFriction`][Self::rollingFriction].
181        #[unsafe(method(setRollingFriction:))]
182        #[unsafe(method_family = none)]
183        pub unsafe fn setRollingFriction(&self, rolling_friction: CGFloat);
184
185        #[cfg(feature = "SCNPhysicsShape")]
186        #[unsafe(method(physicsShape))]
187        #[unsafe(method_family = none)]
188        pub unsafe fn physicsShape(&self) -> Option<Retained<SCNPhysicsShape>>;
189
190        #[cfg(feature = "SCNPhysicsShape")]
191        /// Setter for [`physicsShape`][Self::physicsShape].
192        #[unsafe(method(setPhysicsShape:))]
193        #[unsafe(method_family = none)]
194        pub unsafe fn setPhysicsShape(&self, physics_shape: Option<&SCNPhysicsShape>);
195
196        #[unsafe(method(isResting))]
197        #[unsafe(method_family = none)]
198        pub unsafe fn isResting(&self) -> bool;
199
200        #[unsafe(method(allowsResting))]
201        #[unsafe(method_family = none)]
202        pub unsafe fn allowsResting(&self) -> bool;
203
204        /// Setter for [`allowsResting`][Self::allowsResting].
205        #[unsafe(method(setAllowsResting:))]
206        #[unsafe(method_family = none)]
207        pub unsafe fn setAllowsResting(&self, allows_resting: bool);
208
209        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
210        #[unsafe(method(velocity))]
211        #[unsafe(method_family = none)]
212        pub unsafe fn velocity(&self) -> SCNVector3;
213
214        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
215        /// Setter for [`velocity`][Self::velocity].
216        #[unsafe(method(setVelocity:))]
217        #[unsafe(method_family = none)]
218        pub unsafe fn setVelocity(&self, velocity: SCNVector3);
219
220        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
221        #[unsafe(method(angularVelocity))]
222        #[unsafe(method_family = none)]
223        pub unsafe fn angularVelocity(&self) -> SCNVector4;
224
225        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
226        /// Setter for [`angularVelocity`][Self::angularVelocity].
227        #[unsafe(method(setAngularVelocity:))]
228        #[unsafe(method_family = none)]
229        pub unsafe fn setAngularVelocity(&self, angular_velocity: SCNVector4);
230
231        #[cfg(feature = "objc2-core-foundation")]
232        #[unsafe(method(damping))]
233        #[unsafe(method_family = none)]
234        pub unsafe fn damping(&self) -> CGFloat;
235
236        #[cfg(feature = "objc2-core-foundation")]
237        /// Setter for [`damping`][Self::damping].
238        #[unsafe(method(setDamping:))]
239        #[unsafe(method_family = none)]
240        pub unsafe fn setDamping(&self, damping: CGFloat);
241
242        #[cfg(feature = "objc2-core-foundation")]
243        #[unsafe(method(angularDamping))]
244        #[unsafe(method_family = none)]
245        pub unsafe fn angularDamping(&self) -> CGFloat;
246
247        #[cfg(feature = "objc2-core-foundation")]
248        /// Setter for [`angularDamping`][Self::angularDamping].
249        #[unsafe(method(setAngularDamping:))]
250        #[unsafe(method_family = none)]
251        pub unsafe fn setAngularDamping(&self, angular_damping: CGFloat);
252
253        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
254        #[unsafe(method(velocityFactor))]
255        #[unsafe(method_family = none)]
256        pub unsafe fn velocityFactor(&self) -> SCNVector3;
257
258        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
259        /// Setter for [`velocityFactor`][Self::velocityFactor].
260        #[unsafe(method(setVelocityFactor:))]
261        #[unsafe(method_family = none)]
262        pub unsafe fn setVelocityFactor(&self, velocity_factor: SCNVector3);
263
264        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
265        #[unsafe(method(angularVelocityFactor))]
266        #[unsafe(method_family = none)]
267        pub unsafe fn angularVelocityFactor(&self) -> SCNVector3;
268
269        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
270        /// Setter for [`angularVelocityFactor`][Self::angularVelocityFactor].
271        #[unsafe(method(setAngularVelocityFactor:))]
272        #[unsafe(method_family = none)]
273        pub unsafe fn setAngularVelocityFactor(&self, angular_velocity_factor: SCNVector3);
274
275        #[unsafe(method(categoryBitMask))]
276        #[unsafe(method_family = none)]
277        pub unsafe fn categoryBitMask(&self) -> NSUInteger;
278
279        /// Setter for [`categoryBitMask`][Self::categoryBitMask].
280        #[unsafe(method(setCategoryBitMask:))]
281        #[unsafe(method_family = none)]
282        pub unsafe fn setCategoryBitMask(&self, category_bit_mask: NSUInteger);
283
284        #[unsafe(method(collisionBitMask))]
285        #[unsafe(method_family = none)]
286        pub unsafe fn collisionBitMask(&self) -> NSUInteger;
287
288        /// Setter for [`collisionBitMask`][Self::collisionBitMask].
289        #[unsafe(method(setCollisionBitMask:))]
290        #[unsafe(method_family = none)]
291        pub unsafe fn setCollisionBitMask(&self, collision_bit_mask: NSUInteger);
292
293        #[unsafe(method(contactTestBitMask))]
294        #[unsafe(method_family = none)]
295        pub unsafe fn contactTestBitMask(&self) -> NSUInteger;
296
297        /// Setter for [`contactTestBitMask`][Self::contactTestBitMask].
298        #[unsafe(method(setContactTestBitMask:))]
299        #[unsafe(method_family = none)]
300        pub unsafe fn setContactTestBitMask(&self, contact_test_bit_mask: NSUInteger);
301
302        #[unsafe(method(isAffectedByGravity))]
303        #[unsafe(method_family = none)]
304        pub unsafe fn isAffectedByGravity(&self) -> bool;
305
306        /// Setter for [`isAffectedByGravity`][Self::isAffectedByGravity].
307        #[unsafe(method(setAffectedByGravity:))]
308        #[unsafe(method_family = none)]
309        pub unsafe fn setAffectedByGravity(&self, affected_by_gravity: bool);
310
311        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
312        #[unsafe(method(applyForce:impulse:))]
313        #[unsafe(method_family = none)]
314        pub unsafe fn applyForce_impulse(&self, direction: SCNVector3, impulse: bool);
315
316        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
317        #[unsafe(method(applyForce:atPosition:impulse:))]
318        #[unsafe(method_family = none)]
319        pub unsafe fn applyForce_atPosition_impulse(
320            &self,
321            direction: SCNVector3,
322            position: SCNVector3,
323            impulse: bool,
324        );
325
326        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
327        #[unsafe(method(applyTorque:impulse:))]
328        #[unsafe(method_family = none)]
329        pub unsafe fn applyTorque_impulse(&self, torque: SCNVector4, impulse: bool);
330
331        #[unsafe(method(clearAllForces))]
332        #[unsafe(method_family = none)]
333        pub unsafe fn clearAllForces(&self);
334
335        #[unsafe(method(resetTransform))]
336        #[unsafe(method_family = none)]
337        pub unsafe fn resetTransform(&self);
338
339        #[unsafe(method(setResting:))]
340        #[unsafe(method_family = none)]
341        pub unsafe fn setResting(&self, resting: bool);
342
343        #[cfg(feature = "objc2-core-foundation")]
344        #[unsafe(method(continuousCollisionDetectionThreshold))]
345        #[unsafe(method_family = none)]
346        pub unsafe fn continuousCollisionDetectionThreshold(&self) -> CGFloat;
347
348        #[cfg(feature = "objc2-core-foundation")]
349        /// Setter for [`continuousCollisionDetectionThreshold`][Self::continuousCollisionDetectionThreshold].
350        #[unsafe(method(setContinuousCollisionDetectionThreshold:))]
351        #[unsafe(method_family = none)]
352        pub unsafe fn setContinuousCollisionDetectionThreshold(
353            &self,
354            continuous_collision_detection_threshold: CGFloat,
355        );
356
357        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
358        #[unsafe(method(centerOfMassOffset))]
359        #[unsafe(method_family = none)]
360        pub unsafe fn centerOfMassOffset(&self) -> SCNVector3;
361
362        #[cfg(all(feature = "SceneKitTypes", feature = "objc2-core-foundation"))]
363        /// Setter for [`centerOfMassOffset`][Self::centerOfMassOffset].
364        #[unsafe(method(setCenterOfMassOffset:))]
365        #[unsafe(method_family = none)]
366        pub unsafe fn setCenterOfMassOffset(&self, center_of_mass_offset: SCNVector3);
367
368        #[cfg(feature = "objc2-core-foundation")]
369        #[unsafe(method(linearRestingThreshold))]
370        #[unsafe(method_family = none)]
371        pub unsafe fn linearRestingThreshold(&self) -> CGFloat;
372
373        #[cfg(feature = "objc2-core-foundation")]
374        /// Setter for [`linearRestingThreshold`][Self::linearRestingThreshold].
375        #[unsafe(method(setLinearRestingThreshold:))]
376        #[unsafe(method_family = none)]
377        pub unsafe fn setLinearRestingThreshold(&self, linear_resting_threshold: CGFloat);
378
379        #[cfg(feature = "objc2-core-foundation")]
380        #[unsafe(method(angularRestingThreshold))]
381        #[unsafe(method_family = none)]
382        pub unsafe fn angularRestingThreshold(&self) -> CGFloat;
383
384        #[cfg(feature = "objc2-core-foundation")]
385        /// Setter for [`angularRestingThreshold`][Self::angularRestingThreshold].
386        #[unsafe(method(setAngularRestingThreshold:))]
387        #[unsafe(method_family = none)]
388        pub unsafe fn setAngularRestingThreshold(&self, angular_resting_threshold: CGFloat);
389    );
390}
391
392/// Methods declared on superclass `NSObject`.
393impl SCNPhysicsBody {
394    extern_methods!(
395        #[unsafe(method(init))]
396        #[unsafe(method_family = init)]
397        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
398
399        #[unsafe(method(new))]
400        #[unsafe(method_family = new)]
401        pub unsafe fn new() -> Retained<Self>;
402    );
403}