GFX
  • Docs
  • API
Search Results for

    Show / Hide Table of Contents
    • Genesis.Core
      • AssetManager
      • Game
      • GameElement
      • GameEventHandler
      • GenesisWindow
      • IGameBehavior
      • Input
      • Layer
      • Light
      • Scene
      • Scene3D
      • SceneEventHandler
      • SceneSizeEvenHandler
      • Storage
      • Utils
    • Genesis.Core.Behaviors
      • AnimationBehavior
      • CameraFlags
      • CharacterController2D
      • ControllerPreset
      • MoveDirection
      • MovementFlags
      • SpriteMovementController
    • Genesis.Core.Behaviors.Physics2D
      • BufferedSpriteCollider
      • PhysicsBox2D
      • PhysicsPolygon2D
      • Rigidbody2D
    • Genesis.Core.Behaviors.Physics3D
      • BoxCollider
      • CapsuleCollider
      • ConvexHullBehavior
      • QubeConvexHull
      • SphereCollider
      • StaticMeshBehavior
    • Genesis.Core.Behaviors._3D
      • Stance
      • ThirdpersonCharacterController
    • Genesis.Core.GameElements
      • BufferedSprite
      • CameraElement
      • Element3D
      • Empty
      • Model
      • ParticleBuffers
      • ParticleDeffinition
      • ParticleEmitter
      • Qube
      • RectElement
      • Skybox
      • Sprite
      • SpriteShapeDeffinition
      • Terrain2D
      • Terrain3D
      • TerrainData
    • Genesis.Graphics
      • Animation
      • Camera
      • CameraType
      • Face
      • Font
      • Framebuffer
      • Glyphe
      • IRenderDevice
      • Material
      • MaterialBuffer
      • Mesh
      • PerspectiveCamera
      • Shader
      • ShaderProgram
      • TexCoords
      • Texture
      • Viewport
    • Genesis.Graphics.Animation3D
      • Animation
      • Animator
      • AssimpNodeData
      • Bone
      • KeyPosition
      • KeyRotation
      • KeyScale
      • ModelMesh
      • boneinfo
      • vertex
    • Genesis.Graphics.Physics
      • BulletDebugRenderer
    • Genesis.Graphics.RenderDevice
      • ClassicGL
      • GLRenderer
    • Genesis.Graphics.Shaders.OpenGL
      • AnimatedModelShader
      • BasicShader
      • DiffuseLightning
      • DiffuseNormalLightning
      • DiffuseNormalShader
      • DiffuseShader
      • DiffuseSolidShader
      • MVPRectShader
      • MVPShader
      • MVPSolidShader
      • ParticleShader
      • ScreenShader
      • SkyboxShader
      • SpriteShader
      • TerrainShader
      • WireframeShader
    • Genesis.Graphics.Shapes
      • BufferedSpriteShape
      • FrameShape
      • GlypheShape
      • LineShape
      • PlaneShape
      • QubeShape
      • RectShape
      • Shape
      • SpriteShape
    • Genesis.Math
      • Matrix4x4
      • NoisePoint
      • PerlinNoise
      • Rect
      • Vec3
    • Genesis.Physics
      • Aabb
      • HitResult
      • MatrixSet
      • MouseRay2
      • PhysicHandler
      • PhysicHandlerEvent
      • PhysicPropeterys
      • PhysicsBehavior
      • PhysicsBehaviorEvent
      • PhysicsHandler2D
      • PhysicsHandler3D
      • Raycast
    • Genesis.UI
      • Canvas
      • ImageButton
      • Label
      • ListItem
      • ListItemBehavior
      • ListSelector
      • ListSelectorBehavior
      • Panel
      • ProgressBar
      • UIEvent
      • UIParseHandler
      • UIParser
      • Widget

    Class Rigidbody2D

    Represents a 2D physics behavior for game elements.

    Inheritance
    object
    IGameBehavior
    PhysicsBehavior
    Rigidbody2D
    Inherited Members
    PhysicsBehavior.OnCollide
    PhysicsBehavior.Collide(Scene, Game, RigidBody)
    IGameBehavior.Parent
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Genesis.Core.Behaviors.Physics2D
    Assembly: Genesis.dll
    Syntax
    public class Rigidbody2D : PhysicsBehavior

    Constructors

    Rigidbody2D()

    Declaration
    public Rigidbody2D()

    Properties

    AngularFactor

    Gets or sets the angular factor for the RigidBody's rotation.

    Declaration
    public Vec3 AngularFactor { get; set; }
    Property Value
    Type Description
    Vec3

    EnablePhysic

    Gets or sets whether physics is enabled.

    Declaration
    public bool EnablePhysic { get; set; }
    Property Value
    Type Description
    bool

    LinearFactor

    Gets or sets the linear factor for the RigidBody's motion.

    Declaration
    public Vec3 LinearFactor { get; set; }
    Property Value
    Type Description
    Vec3

    RigidBody

    Gets or sets the RigidBody associated with this 2D physics behavior.

    Declaration
    public RigidBody RigidBody { get; set; }
    Property Value
    Type Description
    RigidBody

    Methods

    CreateRigidbody(PhysicHandler, float)

    Creates a RigidBody with the specified mass using the provided PhysicHandler and default values for capsule radius and height.

    Declaration
    public void CreateRigidbody(PhysicHandler handler, float mass)
    Parameters
    Type Name Description
    PhysicHandler handler

    The PhysicHandler responsible for managing physics elements.

    float mass

    The mass of the RigidBody.

    CreateRigidbody(PhysicHandler, float, float, float)

    Creates a RigidBody with the specified mass using the provided PhysicHandler.

    Declaration
    public void CreateRigidbody(PhysicHandler handler, float mass, float capsuleRadius, float capsuleHeight)
    Parameters
    Type Name Description
    PhysicHandler handler

    The PhysicHandler responsible for managing physics elements.

    float mass

    The mass of the RigidBody.

    float capsuleRadius

    The radius of the capsule shape of the RigidBody.

    float capsuleHeight

    The height of the capsule shape of the RigidBody.

    GetPhysicsObject()

    Gets the physics object associated with this behavior.

    Declaration
    public override object GetPhysicsObject()
    Returns
    Type Description
    object

    The RigidBody physics object.

    Overrides
    PhysicsBehavior.GetPhysicsObject()

    GetPhysicsObject<T>()

    Gets the physics object associated with this behavior, cast to the specified type.

    Declaration
    public override T GetPhysicsObject<T>()
    Returns
    Type Description
    T

    The RigidBody physics object cast to the specified type.

    Type Parameters
    Name Description
    T

    The type to which the physics object is cast.

    Overrides
    PhysicsBehavior.GetPhysicsObject<T>()

    OnDestroy(Game, GameElement)

    Called when the associated game element is being destroyed.

    Declaration
    public override void OnDestroy(Game game, GameElement parent)
    Parameters
    Type Name Description
    Game game

    The current game instance.

    GameElement parent

    The parent game element associated with this behavior.

    Overrides
    IGameBehavior.OnDestroy(Game, GameElement)

    OnInit(Game, GameElement)

    Called when the associated game element is being initialized.

    Declaration
    public override void OnInit(Game game, GameElement parent)
    Parameters
    Type Name Description
    Game game

    The current game instance.

    GameElement parent

    The parent game element associated with this behavior.

    Overrides
    IGameBehavior.OnInit(Game, GameElement)

    OnRender(Game, GameElement)

    Called during the rendering phase of the game update cycle.

    Declaration
    public override void OnRender(Game game, GameElement parent)
    Parameters
    Type Name Description
    Game game

    The current game instance.

    GameElement parent

    The parent game element associated with this behavior.

    Overrides
    IGameBehavior.OnRender(Game, GameElement)

    OnUpdate(Game, GameElement)

    Updates the behavior during the game's update cycle.

    Declaration
    public override void OnUpdate(Game game, GameElement parent)
    Parameters
    Type Name Description
    Game game

    The current game instance.

    GameElement parent

    The parent game element associated with this behavior.

    Overrides
    IGameBehavior.OnUpdate(Game, GameElement)

    UpdateRigidBody()

    Updates the RigidBody's motion state based on the parent's location.

    Declaration
    public void UpdateRigidBody()
    In this article
    Back to top Generated by DocFX