GFX
  • Docs
  • API
Search Results for

    Show / Hide Table of Contents
    • Genesis.Core
      • AssetManager
      • DirectionalLight
      • Game
      • GameElement
      • GameEventHandler
      • IGameBehavior
      • Input
      • Input.Keys
      • Layer
      • Light
      • Light2D
      • PointLight
      • Scene
      • Scene2D
      • Scene3D
      • SceneEventHandler
      • SceneSizeEvenHandler
      • Storage
      • Utils
      • Window
      • Window.WindowEventHandler
      • WindowUtilities
      • WindowUtilities.POINT
      • WindowUtilities.RECT
    • Genesis.Core.Behaviors
      • AnimationBehavior
      • CameraFlags
      • CharacterController2D
      • ControllerPreset
      • MoveDirection
      • MovementFlags
      • SpriteMovementController
    • Genesis.Core.Behaviors.Physics2D
      • BoxCollider
      • BoxRigidBody
      • BoxTrigger2D
      • BufferedSpriteCollider
      • PhysicsBox2D
      • PhysicsPolygon2D
      • Rigidbody2D
    • Genesis.Core.Behaviors.Physics3D
      • BoxCollider
      • BoxRigidBody
      • BoxTrigger
      • CapsuleCollider
      • CapsuleRigidBody
      • CompoundMeshCollider
      • ConvexHullBehavior
      • ConvexHullCollider
      • MeshCollider
      • QubeConvexHull
      • SphereCollider
      • SphereRigidBody
      • SphereTrigger
      • StaticMeshBehavior
    • Genesis.Core.Behaviors._3D
      • Stance
      • ThirdpersonCharacterController
    • Genesis.Core.GameElements
      • BufferedSprite
      • CameraElement
      • Element3D
      • Empty
      • FindPathAsynchResult
      • GridCell
      • Model
      • NavMesh
      • Obstacle
      • ParticleBuffers
      • ParticleDeffinition
      • ParticleEmitter
      • Qube
      • RectElement
      • Skybox
      • Sphere
      • Sprite
      • SpriteShapeDeffinition
      • Terrain2D
      • Terrain3D
      • TerrainData
      • Waypoint
    • Genesis.Graphics
      • Animation
      • AnimationCallback
      • AnimationCallback.AnimationEvent
      • Camera
      • CameraType
      • Face
      • Font
      • Framebuffer
      • Frustum
      • Glyphe
      • IRenderDevice
      • InstancedElement
      • InstancedMesh
      • Material
      • MaterialBuffer
      • Mesh
      • PerspectiveCamera
      • RenderInstanceContainer
      • RenderSettings
      • Shader
      • ShaderProgram
      • SpriteSheet
      • TexCoords
      • Texture
      • Viewport
    • Genesis.Graphics.Animation3D
      • Animation
      • Animator
      • AssimpNodeData
      • Bone
      • KeyPosition
      • KeyRotation
      • KeyScale
      • ModelMesh
      • boneinfo
      • vertex
    • Genesis.Graphics.Physics
      • BulletDebugRenderer
    • Genesis.Graphics.RenderDevice
      • GLRenderer
      • LegacyRenerer
    • Genesis.Graphics.Shaders.OpenGL
      • AnimatedModelShader
      • BasicShader
      • BorderCircleShader
      • DiffuseLightning
      • DiffuseNormalLightning
      • DiffuseNormalShader
      • DiffuseShader
      • DiffuseSolidShader
      • Element3DShader
      • FXScreenSpaceShadowShader
      • InstanceShader2D
      • InstancedShader
      • Light2DShader
      • LightmapShader
      • MVPRectShader
      • MVPShader
      • MVPSolidShader
      • ParticleShader
      • ScreenShader
      • SkyboxShader
      • SolidShapeShader
      • SpecularShader
      • SpriteShader
      • TerrainShader
      • WireframeShader
    • Genesis.Graphics.Shapes
      • BufferedSpriteShape
      • CircleShape
      • FrameShape
      • GlypheShape
      • Light2DShape
      • LineShape
      • PlaneShape
      • QubeShape
      • RectShape
      • Shape
      • SphereShape
      • SpriteShape
    • Genesis.Math
      • Matrix4x4
      • NoisePoint
      • PerlinNoise
      • Rect
      • Vec3
    • Genesis.Physics
      • Aabb
      • ColliderBehavior2D
      • ColliderBehavior3D
      • CollisionGroup
      • CollisionGroupExtensions
      • HitResult
      • HitResult2D
      • MatrixSet
      • MouseRay2
      • PhysicHandler
      • PhysicHandlerEvent
      • PhysicPropeterys
      • PhysicsBehavior
      • PhysicsBehaviorEvent
      • PhysicsHandler2D
      • PhysicsHandler3D
      • Ray2D
      • Raycast
      • Raycast2D
      • RigidBodyBehavior2D
      • RigidBodyBehavior3D
      • TriggerBehavior2D
      • TriggerBehavior3D
    • Genesis.UI
      • Button
      • Canvas
      • GridView
      • ImageButton
      • Label
      • ListItem
      • ListItemBehavior
      • ListSelector
      • ListSelectorBehavior
      • Panel
      • ProgressBar
      • UIEvent
      • UIParseHandler
      • UIParser
      • Widget
      • WidgetAnchor
    • Genesis.UI.Items
      • GridViewImageIcon
      • IItem

    Class Raycast

    Represents a class for performing raycasting in 3D space.

    Inheritance
    object
    Raycast
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Genesis.Physics
    Assembly: Genesis.dll
    Syntax
    public class Raycast

    Constructors

    Raycast(Camera, Viewport)

    Initializes a new instance of the Raycast class.

    Declaration
    public Raycast(Camera camera, Viewport viewport)
    Parameters
    Type Name Description
    Camera camera

    The camera used for raycasting.

    Viewport viewport

    The viewport associated with the raycasting.

    Properties

    Camera

    Gets or sets the camera used for raycasting.

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

    Viewport

    Gets or sets the viewport associated with the raycasting.

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

    Methods

    GetEndVec(Camera, Viewport, int, int)

    Gets the end vector for raycasting based on the mouse cursor position.

    Declaration
    public static vec4 GetEndVec(Camera camera, Viewport vp, int posX, int posY)
    Parameters
    Type Name Description
    Camera camera

    The camera used for raycasting.

    Viewport vp

    The viewport associated with the raycasting.

    int posX

    X-coordinate of the mouse cursor.

    int posY

    Y-coordinate of the mouse cursor.

    Returns
    Type Description
    vec4

    The end vector for raycasting.

    GetMouseWorldPosition(Camera, Viewport, int, int)

    Gets the world position of the mouse cursor based on a given camera and viewport.

    Declaration
    public static Vec3 GetMouseWorldPosition(Camera camera, Viewport viewport, int mouseX, int mouseY)
    Parameters
    Type Name Description
    Camera camera

    The camera used for raycasting.

    Viewport viewport

    The viewport associated with the raycasting.

    int mouseX

    X-coordinate of the mouse cursor.

    int mouseY

    Y-coordinate of the mouse cursor.

    Returns
    Type Description
    Vec3

    World position of the mouse cursor.

    GetMouseWorldPosition(int, int)

    Gets the world position of the mouse cursor.

    Declaration
    public Vec3 GetMouseWorldPosition(int mouseX, int mouseY)
    Parameters
    Type Name Description
    int mouseX

    X-coordinate of the mouse cursor.

    int mouseY

    Y-coordinate of the mouse cursor.

    Returns
    Type Description
    Vec3

    World position of the mouse cursor.

    GetRayDir(vec4, vec4)

    Gets the direction vector for a ray based on start and end vectors.

    Declaration
    public static vec3 GetRayDir(vec4 start, vec4 end)
    Parameters
    Type Name Description
    vec4 start

    The start vector of the ray.

    vec4 end

    The end vector of the ray.

    Returns
    Type Description
    vec3

    The direction vector of the ray.

    GetStartVec(Camera, Viewport, int, int)

    Gets the start vector for raycasting based on the mouse cursor position.

    Declaration
    public static vec4 GetStartVec(Camera camera, Viewport vp, int posX, int posY)
    Parameters
    Type Name Description
    Camera camera

    The camera used for raycasting.

    Viewport vp

    The viewport associated with the raycasting.

    int posX

    X-coordinate of the mouse cursor.

    int posY

    Y-coordinate of the mouse cursor.

    Returns
    Type Description
    vec4

    The start vector for raycasting.

    GetViewProjectionMatrix(Camera)

    Gets the view and projection matrices for raycasting based on a given camera.

    Declaration
    public static MatrixSet GetViewProjectionMatrix(Camera camera)
    Parameters
    Type Name Description
    Camera camera

    The camera for which matrices are calculated.

    Returns
    Type Description
    MatrixSet

    MatrixSet containing the view and projection matrices.

    PerformRaycast(Vec3, Vec3, PhysicHandler)

    Performs a raycast between two 3D points to detect collisions within the physics world.

    Declaration
    public static HitResult PerformRaycast(Vec3 start, Vec3 end, PhysicHandler physicHandler)
    Parameters
    Type Name Description
    Vec3 start

    The starting point of the ray in world space.

    Vec3 end

    The ending point of the ray in world space.

    PhysicHandler physicHandler

    The PhysicHandler responsible for physics simulation and raycasting.

    Returns
    Type Description
    HitResult

    A HitResult object containing information about whether a hit occurred, the collided game element, and the collision details (e.g., location of the hit and collision object).

    Remarks

    The method casts a ray from the start position to the end position. If the ray intersects any object within the physics world, the HitResult will contain details about the hit, including the element hit and the collision object.

    PerformRaycastFromScreen(Camera, Viewport, PhysicHandler, int, int)

    Performs a raycast and returns the hit result based on the mouse cursor position.

    Declaration
    public static HitResult PerformRaycastFromScreen(Camera camera, Viewport viewport, PhysicHandler physicHandler, int posX, int posY)
    Parameters
    Type Name Description
    Camera camera

    The camera used for raycasting.

    Viewport viewport

    The viewport associated with the raycasting.

    PhysicHandler physicHandler

    The physics handler used for raycasting.

    int posX

    X-coordinate of the mouse cursor.

    int posY

    Y-coordinate of the mouse cursor.

    Returns
    Type Description
    HitResult

    HitResult containing information about the raycasting hit.

    PerformRaycastFromScreen(PhysicHandler, int, int)

    Performs a raycast and returns the hit result based on the mouse cursor position.

    Declaration
    public HitResult PerformRaycastFromScreen(PhysicHandler physicHandler, int posX, int posY)
    Parameters
    Type Name Description
    PhysicHandler physicHandler

    The physics handler used for raycasting.

    int posX

    X-coordinate of the mouse cursor.

    int posY

    Y-coordinate of the mouse cursor.

    Returns
    Type Description
    HitResult

    HitResult containing information about the raycasting hit.

    PerformRaycastFromScreenAll(Camera, Viewport, PhysicHandler, int, int)

    Declaration
    public static List<HitResult> PerformRaycastFromScreenAll(Camera camera, Viewport viewport, PhysicHandler physicHandler, int posX, int posY)
    Parameters
    Type Name Description
    Camera camera
    Viewport viewport
    PhysicHandler physicHandler
    int posX
    int posY
    Returns
    Type Description
    List<HitResult>

    PerformRaycastFromScreenFiltered(Camera, Viewport, PhysicHandler, int, int, int, int)

    Declaration
    public static HitResult PerformRaycastFromScreenFiltered(Camera camera, Viewport viewport, PhysicHandler physicHandler, int posX, int posY, int collisionGroup = -1, int collisionMask = -1)
    Parameters
    Type Name Description
    Camera camera
    Viewport viewport
    PhysicHandler physicHandler
    int posX
    int posY
    int collisionGroup
    int collisionMask
    Returns
    Type Description
    HitResult
    In this article
    Back to top Generated by DocFX