public class SKPhysicsBody extends NSObject implements NSCopying, NSSecureCoding
All bodies have zero, one or more shapes that define its area. A body with no shapes is ethereal and does not collide with other bodies.
NSObject.Function_instanceMethodForSelector_ret, NSObject.Function_methodForSelector_ret| Modifier | Constructor and Description |
|---|---|
protected |
SKPhysicsBody(org.moe.natj.general.Pointer peer) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
_supportsSecureCoding()
This property must return YES on all classes that allow secure coding.
|
static boolean |
accessInstanceVariablesDirectly() |
boolean |
affectedByGravity()
Bodies are affected by field forces such as gravity if this property is set and the field's category mask is set appropriately.
|
NSArray<? extends SKPhysicsBody> |
allContactedBodies()
Returns an array of all SKPhysicsBodies currently in contact with this one
|
static SKPhysicsBody |
alloc() |
static SKPhysicsBody |
allocWithZone(org.moe.natj.general.ptr.VoidPtr zone) |
boolean |
allowsRotation() |
double |
angularDamping()
Optionally reduce the body's angular velocity each frame to simulate rotational friction.
|
double |
angularVelocity() |
void |
applyAngularImpulse(double impulse) |
void |
applyForce(CGVector force) |
void |
applyForceAtPoint(CGVector force,
CGPoint point) |
void |
applyImpulse(CGVector impulse) |
void |
applyImpulseAtPoint(CGVector impulse,
CGPoint point) |
void |
applyTorque(double torque) |
double |
area()
The area of the body.
|
static boolean |
automaticallyNotifiesObserversForKey(java.lang.String key) |
static SKPhysicsBody |
bodyWithBodies(NSArray<? extends SKPhysicsBody> bodies)
Creates an compound body that is the union of the bodies used to create it.
|
static SKPhysicsBody |
bodyWithCircleOfRadius(double r)
Creates a circle of radius r centered at the node's origin.
|
static SKPhysicsBody |
bodyWithCircleOfRadiusCenter(double r,
CGPoint center)
Creates a circle of radius r centered at a point in the node's coordinate space.
|
static SKPhysicsBody |
bodyWithEdgeChainFromPath(CGPathRef path)
Creates an edge chain from a path.
|
static SKPhysicsBody |
bodyWithEdgeFromPointToPoint(CGPoint p1,
CGPoint p2)
Creates an edge from p1 to p2.
|
static SKPhysicsBody |
bodyWithEdgeLoopFromPath(CGPathRef path)
Creates an edge loop from a path.
|
static SKPhysicsBody |
bodyWithEdgeLoopFromRect(CGRect rect)
Creates an edge loop from a CGRect.
|
static SKPhysicsBody |
bodyWithPolygonFromPath(CGPathRef path)
The path must represent a convex or concave polygon with counter clockwise winding and no self intersection.
|
static SKPhysicsBody |
bodyWithRectangleOfSize(CGSize s)
Creates a rectangle of the specified size centered at the node's origin.
|
static SKPhysicsBody |
bodyWithRectangleOfSizeCenter(CGSize s,
CGPoint center)
Creates a rectangle of the specified size centered at a point in the node's coordinate space.
|
static SKPhysicsBody |
bodyWithTextureAlphaThresholdSize(SKTexture texture,
float alphaThreshold,
CGSize size)
Creates a body from the alpha values in the supplied texture.
|
static SKPhysicsBody |
bodyWithTextureSize(SKTexture texture,
CGSize size)
Creates a body from the alpha values in the supplied texture.
|
static void |
cancelPreviousPerformRequestsWithTarget(java.lang.Object aTarget) |
static void |
cancelPreviousPerformRequestsWithTargetSelectorObject(java.lang.Object aTarget,
org.moe.natj.objc.SEL aSelector,
java.lang.Object anArgument) |
int |
categoryBitMask()
Defines what logical 'categories' this body belongs to.
|
double |
charge()
Specifies the charge on the body.
|
static NSArray<java.lang.String> |
classFallbacksForKeyedArchiver() |
static org.moe.natj.objc.Class |
classForKeyedUnarchiver() |
int |
collisionBitMask()
Defines what logical 'categories' of bodies this body responds to collisions with.
|
int |
contactTestBitMask()
Defines what logical 'categories' of bodies this body generates intersection notifications with.
|
java.lang.Object |
copyWithZone(org.moe.natj.general.ptr.VoidPtr zone) |
static java.lang.String |
debugDescription_static() |
double |
density()
The density of the body.
|
static java.lang.String |
description_static() |
void |
encodeWithCoder(NSCoder coder) |
int |
fieldBitMask()
Defines what logical 'categories' of fields this body responds to.
|
double |
friction()
Determines the 'roughness' for the surface of the physics body (0.0 - 1.0).
|
static long |
hash_static() |
SKPhysicsBody |
init() |
SKPhysicsBody |
initWithCoder(NSCoder coder)
NS_DESIGNATED_INITIALIZER
|
static NSObject.Function_instanceMethodForSelector_ret |
instanceMethodForSelector(org.moe.natj.objc.SEL aSelector) |
static NSMethodSignature |
instanceMethodSignatureForSelector(org.moe.natj.objc.SEL aSelector) |
static boolean |
instancesRespondToSelector(org.moe.natj.objc.SEL aSelector) |
boolean |
isDynamic() |
boolean |
isResting()
If the physics simulation has determined that this body is at rest it may set the resting property to YES.
|
static boolean |
isSubclassOfClass(org.moe.natj.objc.Class aClass) |
NSArray<? extends SKPhysicsJoint> |
joints() |
static NSSet<java.lang.String> |
keyPathsForValuesAffectingValueForKey(java.lang.String key) |
double |
linearDamping()
Optionally reduce the body's linear velocity each frame to simulate fluid/air friction.
|
double |
mass()
The mass of the body.
|
static SKPhysicsBody |
new_objc() |
SKNode |
node()
The representedObject this physicsBody is currently bound to, or nil if it is not.
|
boolean |
pinned() |
static boolean |
resolveClassMethod(org.moe.natj.objc.SEL sel) |
static boolean |
resolveInstanceMethod(org.moe.natj.objc.SEL sel) |
double |
restitution()
Determines the 'bounciness' of the physics body (0.0 - 1.0).
|
void |
setAffectedByGravity(boolean value)
Bodies are affected by field forces such as gravity if this property is set and the field's category mask is set appropriately.
|
void |
setAllowsRotation(boolean value) |
void |
setAngularDamping(double value)
Optionally reduce the body's angular velocity each frame to simulate rotational friction.
|
void |
setAngularVelocity(double value) |
void |
setCategoryBitMask(int value)
Defines what logical 'categories' this body belongs to.
|
void |
setCharge(double value)
Specifies the charge on the body.
|
void |
setCollisionBitMask(int value)
Defines what logical 'categories' of bodies this body responds to collisions with.
|
void |
setContactTestBitMask(int value)
Defines what logical 'categories' of bodies this body generates intersection notifications with.
|
void |
setDensity(double value)
The density of the body.
|
void |
setDynamic(boolean value) |
void |
setFieldBitMask(int value)
Defines what logical 'categories' of fields this body responds to.
|
void |
setFriction(double value)
Determines the 'roughness' for the surface of the physics body (0.0 - 1.0).
|
void |
setLinearDamping(double value)
Optionally reduce the body's linear velocity each frame to simulate fluid/air friction.
|
void |
setMass(double value)
The mass of the body.
|
void |
setPinned(boolean value) |
void |
setResting(boolean value)
If the physics simulation has determined that this body is at rest it may set the resting property to YES.
|
void |
setRestitution(double value)
Determines the 'bounciness' of the physics body (0.0 - 1.0).
|
void |
setUsesPreciseCollisionDetection(boolean value) |
void |
setVelocity(CGVector value) |
static void |
setVersion_static(long aVersion) |
static org.moe.natj.objc.Class |
superclass_static() |
static boolean |
supportsSecureCoding() |
boolean |
usesPreciseCollisionDetection() |
CGVector |
velocity() |
static long |
version_static() |
accessibilityActivate, accessibilityActivationPoint, accessibilityAssistiveTechnologyFocusedIdentifiers, accessibilityAttributedHint, accessibilityAttributedLabel, accessibilityAttributedUserInputLabels, accessibilityAttributedValue, accessibilityContainerType, accessibilityCustomActions, accessibilityCustomRotors, accessibilityDecrement, accessibilityDragSourceDescriptors, accessibilityDropPointDescriptors, accessibilityElementAtIndex, accessibilityElementCount, accessibilityElementDidBecomeFocused, accessibilityElementDidLoseFocus, accessibilityElementIsFocused, accessibilityElements, accessibilityElementsHidden, accessibilityFrame, accessibilityHint, accessibilityIncrement, accessibilityLabel, accessibilityLanguage, accessibilityNavigationStyle, accessibilityPath, accessibilityPerformEscape, accessibilityPerformMagicTap, accessibilityRespondsToUserInteraction, accessibilityScroll, accessibilityTextualContext, accessibilityTraits, accessibilityUserInputLabels, accessibilityValue, accessibilityViewIsModal, addObserverForKeyPathOptionsContext, attemptRecoveryFromErrorOptionIndex, attemptRecoveryFromErrorOptionIndexDelegateDidRecoverSelectorContextInfo, autoContentAccessingProxy, awakeAfterUsingCoder, awakeFromNib, class_objc, classForCoder, classForKeyedArchiver, copy, dealloc, debugDescription, description, dictionaryWithValuesForKeys, didChangeValueForKey, didChangeValueForKeyWithSetMutationUsingObjects, didChangeValuesAtIndexesForKey, doesNotRecognizeSelector, fileManagerShouldProceedAfterError, fileManagerWillProcessPath, finalize_objc, forwardingTargetForSelector, forwardInvocation, hash, indexOfAccessibilityElement, isAccessibilityElement, isEqual, isKindOfClass, isMemberOfClass, isProxy, methodForSelector, methodSignatureForSelector, mutableArrayValueForKey, mutableArrayValueForKeyPath, mutableCopy, mutableOrderedSetValueForKey, mutableOrderedSetValueForKeyPath, mutableSetValueForKey, mutableSetValueForKeyPath, observationInfo, observeValueForKeyPathOfObjectChangeContext, performSelector, performSelectorInBackgroundWithObject, performSelectorOnMainThreadWithObjectWaitUntilDone, performSelectorOnMainThreadWithObjectWaitUntilDoneModes, performSelectorOnThreadWithObjectWaitUntilDone, performSelectorOnThreadWithObjectWaitUntilDoneModes, performSelectorWithObject, performSelectorWithObjectAfterDelay, performSelectorWithObjectAfterDelayInModes, performSelectorWithObjectWithObject, prepareForInterfaceBuilder, provideImageDataBytesPerRowOrigin_Size_UserInfo, removeObserverForKeyPath, removeObserverForKeyPathContext, replacementObjectForCoder, replacementObjectForKeyedArchiver, respondsToSelector, self, setAccessibilityActivationPoint, setAccessibilityAttributedHint, setAccessibilityAttributedLabel, setAccessibilityAttributedUserInputLabels, setAccessibilityAttributedValue, setAccessibilityContainerType, setAccessibilityCustomActions, setAccessibilityCustomRotors, setAccessibilityDragSourceDescriptors, setAccessibilityDropPointDescriptors, setAccessibilityElements, setAccessibilityElementsHidden, setAccessibilityFrame, setAccessibilityHint, setAccessibilityLabel, setAccessibilityLanguage, setAccessibilityNavigationStyle, setAccessibilityPath, setAccessibilityRespondsToUserInteraction, setAccessibilityTextualContext, setAccessibilityTraits, setAccessibilityUserInputLabels, setAccessibilityValue, setAccessibilityViewIsModal, setIsAccessibilityElement, setNilValueForKey, setObservationInfo, setShouldGroupAccessibilityChildren, setValueForKey, setValueForKeyPath, setValueForUndefinedKey, setValuesForKeysWithDictionary, shouldGroupAccessibilityChildren, superclass, validateValueForKeyError, validateValueForKeyPathError, valueForKey, valueForKeyPath, valueForUndefinedKey, willChangeValueForKey, willChangeValueForKeyWithSetMutationUsingObjects, willChangeValuesAtIndexesForKeypublic static boolean accessInstanceVariablesDirectly()
public static SKPhysicsBody alloc()
public static SKPhysicsBody allocWithZone(org.moe.natj.general.ptr.VoidPtr zone)
public static boolean automaticallyNotifiesObserversForKey(java.lang.String key)
public static SKPhysicsBody bodyWithBodies(NSArray<? extends SKPhysicsBody> bodies)
public static SKPhysicsBody bodyWithCircleOfRadius(double r)
r - the radius in pointspublic static SKPhysicsBody bodyWithCircleOfRadiusCenter(double r, CGPoint center)
r - the radius in pointspublic static SKPhysicsBody bodyWithEdgeChainFromPath(CGPathRef path)
path - the path to usepublic static SKPhysicsBody bodyWithEdgeFromPointToPoint(CGPoint p1, CGPoint p2)
p1 - start pointp2 - end pointpublic static SKPhysicsBody bodyWithEdgeLoopFromPath(CGPathRef path)
path - the path to usepublic static SKPhysicsBody bodyWithEdgeLoopFromRect(CGRect rect)
rect - the CGRect to usepublic static SKPhysicsBody bodyWithPolygonFromPath(CGPathRef path)
path - the path to usepublic static SKPhysicsBody bodyWithRectangleOfSize(CGSize s)
s - the size in pointspublic static SKPhysicsBody bodyWithRectangleOfSizeCenter(CGSize s, CGPoint center)
s - the size in pointspublic static SKPhysicsBody bodyWithTextureAlphaThresholdSize(SKTexture texture, float alphaThreshold, CGSize size)
texture - the texture to be interpretedalphaThreshold - the alpha value above which a pixel is interpreted as opaquesize - of the generated physics bodypublic static SKPhysicsBody bodyWithTextureSize(SKTexture texture, CGSize size)
texture - the texture to be interpretedsize - of the generated physics bodypublic static void cancelPreviousPerformRequestsWithTarget(java.lang.Object aTarget)
public static void cancelPreviousPerformRequestsWithTargetSelectorObject(java.lang.Object aTarget,
org.moe.natj.objc.SEL aSelector,
java.lang.Object anArgument)
public static NSArray<java.lang.String> classFallbacksForKeyedArchiver()
public static org.moe.natj.objc.Class classForKeyedUnarchiver()
public static java.lang.String debugDescription_static()
public static java.lang.String description_static()
public static long hash_static()
public static NSObject.Function_instanceMethodForSelector_ret instanceMethodForSelector(org.moe.natj.objc.SEL aSelector)
public static NSMethodSignature instanceMethodSignatureForSelector(org.moe.natj.objc.SEL aSelector)
public static boolean instancesRespondToSelector(org.moe.natj.objc.SEL aSelector)
public static boolean isSubclassOfClass(org.moe.natj.objc.Class aClass)
public static NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey(java.lang.String key)
public static SKPhysicsBody new_objc()
public static boolean resolveClassMethod(org.moe.natj.objc.SEL sel)
public static boolean resolveInstanceMethod(org.moe.natj.objc.SEL sel)
public static void setVersion_static(long aVersion)
public static org.moe.natj.objc.Class superclass_static()
public static long version_static()
public boolean affectedByGravity()
If this is set a force is applied to the object based on the mass. Set the field force vector in the scene to modify the strength of the force.
public NSArray<? extends SKPhysicsBody> allContactedBodies()
public boolean allowsRotation()
public double angularDamping()
public double angularVelocity()
public void applyAngularImpulse(double impulse)
public void applyForce(CGVector force)
public void applyImpulse(CGVector impulse)
public void applyTorque(double torque)
public double area()
The unit is arbitrary, as long as the relative areas are consistent throughout the application.
public int categoryBitMask()
public double charge()
public int collisionBitMask()
public int contactTestBitMask()
public java.lang.Object copyWithZone(org.moe.natj.general.ptr.VoidPtr zone)
copyWithZone in interface NSCopyingpublic double density()
The unit is arbitrary, as long as the relative densities are consistent throughout the application. Note that density and mass are inherently related (they are directly proportional), so changing one also changes the other. Both are provided so either can be used depending on what is more relevant to your usage.
public void encodeWithCoder(NSCoder coder)
encodeWithCoder in interface NSCodingpublic int fieldBitMask()
public double friction()
public SKPhysicsBody init()
public SKPhysicsBody initWithCoder(NSCoder coder)
NSCodinginitWithCoder in interface NSCodingpublic boolean isDynamic()
public void setDynamic(boolean value)
public boolean isResting()
public void setResting(boolean value)
public NSArray<? extends SKPhysicsJoint> joints()
public double linearDamping()
public double mass()
The unit is arbitrary, as long as the relative masses are consistent throughout the application. Note that density and mass are inherently related (they are directly proportional), so changing one also changes the other. Both are provided so either can be used depending on what is more relevant to your usage.
public SKNode node()
public boolean pinned()
public double restitution()
public void setAffectedByGravity(boolean value)
If this is set a force is applied to the object based on the mass. Set the field force vector in the scene to modify the strength of the force.
public void setAllowsRotation(boolean value)
public void setAngularDamping(double value)
public void setAngularVelocity(double value)
public void setCategoryBitMask(int value)
public void setCharge(double value)
public void setCollisionBitMask(int value)
public void setContactTestBitMask(int value)
public void setDensity(double value)
The unit is arbitrary, as long as the relative densities are consistent throughout the application. Note that density and mass are inherently related (they are directly proportional), so changing one also changes the other. Both are provided so either can be used depending on what is more relevant to your usage.
public void setFieldBitMask(int value)
public void setFriction(double value)
public void setLinearDamping(double value)
public void setMass(double value)
The unit is arbitrary, as long as the relative masses are consistent throughout the application. Note that density and mass are inherently related (they are directly proportional), so changing one also changes the other. Both are provided so either can be used depending on what is more relevant to your usage.
public void setPinned(boolean value)
public void setRestitution(double value)
public void setUsesPreciseCollisionDetection(boolean value)
public void setVelocity(CGVector value)
public boolean usesPreciseCollisionDetection()
public CGVector velocity()
public static boolean supportsSecureCoding()
public boolean _supportsSecureCoding()
NSSecureCoding_supportsSecureCoding in interface NSSecureCoding