Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PhysX based raycast and collider #483

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions packages/core/src/Engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ import { ShaderPool } from "./shader/ShaderPool";
import { ShaderProgramPool } from "./shader/ShaderProgramPool";
import { RenderState } from "./shader/state/RenderState";
import { Texture2D, TextureCubeFace, TextureCubeMap, TextureFormat } from "./texture";
import { PhysicsManager } from "./PhysicsManager";
// import { PhysicsManager } from "./PhysicsManager";
import { ModelMesh, PrimitiveMesh } from "./mesh";
import { CompareFunction } from "./shader";
import { IPhysicsEngine } from "@oasis-engine/design";
import { PHYSX } from "../../physics-physx/src/physx.release.js";

/** TODO: delete */
const engineFeatureManager = new FeatureManager<EngineFeature>();
Expand All @@ -38,10 +40,11 @@ ShaderPool.init();
*/
export class Engine extends EventDispatcher {
/** Physics manager of Engine. */
readonly physicsManager: PhysicsManager = new PhysicsManager(this);
// readonly physicsManager: PhysicsManager = new PhysicsManager(this);

_componentsManager: ComponentsManager = new ComponentsManager();
_hardwareRenderer: IHardwareRenderer;
_physicsEngine: IPhysicsEngine;
_lastRenderState: RenderState = new RenderState();
_renderElementPool: ClassPool<RenderElement> = new ClassPool(RenderElement);
_spriteElementPool: ClassPool<SpriteElement> = new ClassPool(SpriteElement);
Expand Down Expand Up @@ -197,6 +200,16 @@ export class Engine extends EventDispatcher {
this._backgroundTextureMesh.isGCIgnored = true;
}

/**
* Engine Initialization after asynchronous loader i.e. WASM.
* @param _cb initialization callback.
*/
init(_cb) {
PHYSX().then(function (PHYSX) {
_cb(PHYSX);
});
}

/**
* Create an entity.
* @param name - The name of the entity
Expand Down
16 changes: 0 additions & 16 deletions packages/core/src/HitResult.ts

This file was deleted.

135 changes: 0 additions & 135 deletions packages/core/src/PhysicsManager.ts

This file was deleted.

7 changes: 0 additions & 7 deletions packages/core/src/Scene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,4 @@ export class Scene extends EngineObject {
}

features: SceneFeature[] = [];

/**
* Raycast.
* @deprecated
* @param ray
*/
public raycast(ray: { origin: Vector3; direction: Vector3 }, outPos?: Vector3, tag?: Layer): any {}
}
38 changes: 19 additions & 19 deletions packages/core/src/Script.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Camera } from "./Camera";
import { ignoreClone } from "./clone/CloneManager";
import { Component } from "./Component";
import { ACollider } from "./collider";
// import { ACollider } from "./collider";
/**
* Script class, used for logic writing.
*/
Expand Down Expand Up @@ -66,24 +66,24 @@ export class Script extends Component {
*/
onEndRender(camera: Camera): void {}

/**
* Called when the collision enter.
* @param other Collider
*/
onTriggerEnter(other: ACollider): void {}

/**
* Called when the collision stay.
* @remarks onTriggerStay is called every frame while the collision stay.
* @param other Collider
*/
onTriggerStay(other: ACollider): void {}

/**
* Called when the collision exit.
* @param other Collider
*/
onTriggerExit(other: ACollider): void {}
// /**
// * Called when the collision enter.
// * @param other Collider
// */
// onTriggerEnter(other: ACollider): void {}
//
// /**
// * Called when the collision stay.
// * @remarks onTriggerStay is called every frame while the collision stay.
// * @param other Collider
// */
// onTriggerStay(other: ACollider): void {}
//
// /**
// * Called when the collision exit.
// * @param other Collider
// */
// onTriggerExit(other: ACollider): void {}

/**
* Called when the pointer is down while over the Collider.
Expand Down
127 changes: 0 additions & 127 deletions packages/core/src/collider/ABoxCollider.ts

This file was deleted.

Loading