PhysicsBody2D
Abstract base class for 2D game objects affected by physics.
class PhysicsBody2DPhysicsBody2D is an abstract base class for 2D game objects affected by physics. All 2D physics bodies inherit from it.
Abstract base class for 2D game objects affected by physics.
class PhysicsBody2DPhysicsBody2D is an abstract base class for 2D game objects affected by physics. All 2D physics bodies inherit from it.
import SwiftGodotFramework to write Godot Game Extensions using the Swift Programming Language.
class CollisionObject2DAbstract base class for 2D physics objects.
protocol CustomStringConvertibleA type with a customized textual representation.
protocol EquatableA type that can be compared for value equality.
protocol Hashable : EquatableA type that can be hashed into a Hasher to produce an integer hash value.
protocol Identifiable<ID>A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable : VariantStorableTypes that conform to VariantRepresentable can be stored directly in Variant with no conversion. These include all of the Variant types from Godot (for example GString, Rect, Plane), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.
protocol VariantStorableTypes that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
override class var godotClassName: StringName { get }final func addCollisionExceptionWith(body: Node?) Adds a body to the list of bodies that this body can’t collide with.
final func getCollisionExceptions() -> ObjectCollection<PhysicsBody2D> Returns an array of nodes that were added as collision exceptions for this body.
final func getGravity() -> Vector2 Returns the gravity vector computed from all sources that can affect the body, including all gravity overrides from Area2D nodes and the global world gravity.
final func moveAndCollide(motion: Vector2, testOnly: Bool = false, safeMargin: Double = 0.08, recoveryAsCollision: Bool = false) -> KinematicCollision2D? Moves the body along the vector motion. In order to be frame rate independent in _physicsProcess(delta:) or _process(delta:), motion should be computed using delta.
final func removeCollisionExceptionWith(body: Node?) Removes a body from the list of bodies that this body can’t collide with.
final func testMove(from: Transform2D, motion: Vector2, collision: KinematicCollision2D? = nil, safeMargin: Double = 0.08, recoveryAsCollision: Bool = false) -> Bool Checks for collisions without moving the body. In order to be frame rate independent in _physicsProcess(delta:) or _process(delta:), motion should be computed using delta.
class CharacterBody2DA 2D physics body specialized for characters moved by script.
class RigidBody2DA 2D physics body that is moved by a physics simulation.
class StaticBody2DA 2D physics body that can’t be moved by external forces. When moved manually, it doesn’t affect other bodies in its path.