forked from excaliburjs/Excalibur
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [excaliburjs#2401] Implement arbitrary raycasting (excaliburjs#…
…2410) Closes excaliburjs#2401 This PR implements an arbitrary raycasting api in Excalibur ```typescript const hits = engine.currentScene.physics.rayCast(new ex.Ray(player.pos, ex.Vector.Down), { maxDistance: 100, collisionGroup: blockGroup, searchAllColliders: false }); ``` <img width="797" alt="image" src="https://user-images.githubusercontent.com/612071/178625499-d9f97052-5b18-49fe-9440-89bd93e46ff6.png"> ## Changes: - Fix issue where TileMaps weren't correctly added to the collider data structure - Add physics world with raycasting endpoint
- Loading branch information
Showing
11 changed files
with
278 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Ray } from '../Math/ray'; | ||
import { DynamicTreeCollisionProcessor, RayCastHit, RayCastOptions } from './Index'; | ||
|
||
|
||
export class PhysicsWorld { | ||
public collisionProcessor: DynamicTreeCollisionProcessor; | ||
constructor() { | ||
this.collisionProcessor = new DynamicTreeCollisionProcessor(); | ||
} | ||
|
||
public rayCast(ray: Ray, options?: RayCastOptions): RayCastHit[] { | ||
return this.collisionProcessor.rayCast(ray, options); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.