|
RayHitSprite | |
CollisionFlag = RayHitSprite(RayX1, RayY1, RayX2, RayY2, SpriteIndex) | |
Parameters: RayX1 = The Rays Starting X coordinate RayY1 = The Rays Starting Y coordinate RayX2 = The Rays Ending X coordinate RayY2 = The Rays Ending Y coordinate SpriteIndex = The Sprite to check for intersection against |
|
Returns: CollisionFlag = The result of the collision query (0= No collision ,1 = Collision) |
|
The RayHitSprite function returns if a collision occurs between a ray and a sprite. When testing the sprite the RayHitSprite command uses the sprites current collision mode as the hard region of the sprite. If a collision occurs, the closest impact point on the sprite (along the ray) is returned as well as the normal at the point of intersection. These values can be access via GetIntersectX# / GetIntersectY# & GetNormalX# / GetNormalY# functions. FACTS: * RayHitSprite uses the sprites collision mode as the hard region of the sprite. * Point of intersection is returned in GetIntersectX# / GetIntersectY# * The Normal at the Point of Intersection is returned in GetNormalX# / GetNormalY# * See SpriteCollisionMode about collision modes. Mini Tutorial: This example creates a random image, creates 10 randomly positioned sprites on the screen using this image. The main loop rotates the sprites while scans them for collisions using RayHitSprite
|
|
|||||||||||||||||||||||||||||||||||||||
(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com |