Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/armomu/ergoudan
使用 Babylon.js 6 的 Havok 物理角色控制器 Havok physics character controller using Babylon.js 6
https://github.com/armomu/ergoudan
babylonjs babylonjs-character-controller babylonjs-game physics-character-controller third-person-controller
Last synced: about 2 months ago
JSON representation
使用 Babylon.js 6 的 Havok 物理角色控制器 Havok physics character controller using Babylon.js 6
- Host: GitHub
- URL: https://github.com/armomu/ergoudan
- Owner: armomu
- License: mit
- Created: 2018-07-04T03:36:01.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-03-15T09:27:30.000Z (9 months ago)
- Last Synced: 2024-03-16T09:27:23.838Z (9 months ago)
- Topics: babylonjs, babylonjs-character-controller, babylonjs-game, physics-character-controller, third-person-controller
- Language: TypeScript
- Homepage: https://armomu.github.io/ergoudan/
- Size: 32 MB
- Stars: 39
- Watchers: 7
- Forks: 9
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-babylonjs - ergoudan - Havok physics character controller demo. ([demo](https://armomu.github.io/ergoudan/#/)) (Projects)
README
# Ergoudan
### This is a simple Havok physics character controller demo using Babylon.js 6、7
原理很简单,使用 Havok 物理线性移动控制角色
The principle is very simple, use havok physics to move the character linearly, Control character using WSAD and space keys
## Screenshot
## Online Demo
[https://armomu.github.io/ergoudan/](https://armomu.github.io/ergoudan/)
[https://daisy-kaliman.vercel.app/#/index](https://daisy-kaliman.vercel.app/#/index)
## Use it
#### Clone the project and run it directly locally
```
git clone https://github.com/armomu/ergoudan.gitcd ergoudan
pnpm install
pnpm run dev
```#### Use in your project
Copy `src/views/serves/thirdPersonController.ts` and `public/textures/x-bot.glb` to your project directory
Change file path
```typescript
// thirdPersonController.ts
// 503 line/**
* Load a scene into an asset container
* @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)
* @param sceneFilename a string that defines the name of the scene file or starts with "data:" following by the stringified version of the scene or a File object (default: empty string)
* @param scene is the instance of BABYLON.Scene to append to (default: last created scene)
* ...omit
* @returns The loaded plugin
*/
BABYLON.SceneLoader.LoadAssetContainer(
import.meta.env.BASE_URL + rootUrl, // Output /ergoudan/textures/ Change to your `ENV BASE_URL` directory
sceneFilename // Output x-bot.glb
);
```Use
```typescript
import { ThirdPersonController } from './thirdPersonController';new ThirdPersonController(camera, scene);
```## Parameter
> package.json dependencies `@babylonjs/havok: 1.1.4` Required
```typescript
export class ThirdPersonController {
/**
* Creates a new ThirdPersonController
* @param camera Required BABYLON.ArcRotateCamera
* @param scene Required BABYLON.Scene
*/
constructor(camera: BABYLON.ArcRotateCamera, scene: BABYLON.Scene) {
}}
```
| Methods | desc |
| ------------------------------- | ----------------------- |
| dispose() | Destroy the current character controller |## TODO
- ✅ Havok Physics engine
- ✅ Contrl character using WASD
- ✅ Jump
- ✅ Climb stairs
- ✅ Uphill and downhill
- ❌ First person control
- ❌ Mobile device
- ❌ Npm package