-
-
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.
) * Add `<Physics />` and `<RigidBody />` components * feat: world and rigid boxy * chore: debug component option --------- Co-authored-by: alvarosabu <alvaro.saburido@gmail.com>
- Loading branch information
1 parent
d71bb32
commit 0b271cb
Showing
14 changed files
with
516 additions
and
68 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 was deleted.
Oops, something went wrong.
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,56 @@ | ||
<script setup lang="ts"> | ||
import { TresCanvas } from '@tresjs/core' | ||
import { OrbitControls } from '@tresjs/cientos' | ||
import { Physics, RigidBody } from '@tresjs/rapier' | ||
import { SRGBColorSpace, ACESFilmicToneMapping } from 'three' | ||
const gl = { | ||
clearColor: '#82DBC5', | ||
shadows: true, | ||
alpha: false, | ||
outputColorSpace: SRGBColorSpace, | ||
toneMapping: ACESFilmicToneMapping, | ||
} | ||
</script> | ||
|
||
<template> | ||
<TresCanvas | ||
v-bind="gl" | ||
window-size | ||
> | ||
<TresPerspectiveCamera | ||
:position="[11, 11, 11]" | ||
:look-at="[0, 0, 0]" | ||
/> | ||
<OrbitControls /> | ||
<Suspense> | ||
<Physics debug> | ||
<RigidBody> | ||
<TresMesh :position="[0, 4, 0]"> | ||
<TresBoxGeometry /> | ||
<TresMeshNormalMaterial /> | ||
</TresMesh> | ||
</RigidBody> | ||
<RigidBody | ||
v-for="ball in [1, 2, 3, 4, 5, 6, 7] " | ||
:key="ball" | ||
collider="ball" | ||
> | ||
<TresMesh :position="[Math.random() * 2, Math.random() * 2 + 8, Math.random() * 2]"> | ||
<TresSphereGeometry /> | ||
<TresMeshNormalMaterial /> | ||
</TresMesh> | ||
</RigidBody> | ||
<RigidBody type="fixed"> | ||
<TresMesh> | ||
<TresPlaneGeometry | ||
:args="[20, 20, 20]" | ||
:rotate-x="-Math.PI / 2" | ||
/> | ||
<TresMeshBasicMaterial color="#f4f4f4" /> | ||
</TresMesh> | ||
</RigidBody> | ||
</Physics> | ||
</Suspense> | ||
</TresCanvas> | ||
</template> |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
export const basicsRoutes = [ | ||
{ | ||
path: '/basics/basic-setup', | ||
name: 'Basic Setup', | ||
component: () => import('../../pages/basics/BasicsDemo.vue'), | ||
path: '/basics/rigid-body', | ||
name: 'Rigid Body', | ||
component: () => import('../../pages/basics/RigidBodyDemo.vue'), | ||
}, | ||
] |
Oops, something went wrong.