|
| 1 | +<script setup lang="ts"> |
| 2 | +import { OrbitControls } from '@tresjs/cientos' |
| 3 | +import { TresCanvas } from '@tresjs/core' |
| 4 | +import { BallCollider, CapsuleCollider, ConeCollider, CuboidCollider, CylinderCollider, Physics, RigidBody } from '@tresjs/rapier' |
| 5 | +import { ACESFilmicToneMapping, SRGBColorSpace } from 'three' |
| 6 | +
|
| 7 | +const gl = { |
| 8 | + clearColor: '#82DBC5', |
| 9 | + shadows: true, |
| 10 | + alpha: false, |
| 11 | + outputColorSpace: SRGBColorSpace, |
| 12 | + toneMapping: ACESFilmicToneMapping, |
| 13 | +} |
| 14 | +</script> |
| 15 | + |
| 16 | +<template> |
| 17 | + <TresCanvas v-bind="gl" window-size> |
| 18 | + <TresPerspectiveCamera :position="[11, 11, 11]" :look-at="[0, 0, 0]" /> |
| 19 | + <OrbitControls /> |
| 20 | + |
| 21 | + <Suspense> |
| 22 | + <Physics debug> |
| 23 | + <RigidBody> |
| 24 | + <BallCollider :args="[1, 1, 1]" :position="[2, 10, 0]" /> |
| 25 | + <CapsuleCollider :args="[1, 1, 1]" :position="[-2, 10, 0]" /> |
| 26 | + <ConeCollider :args="[1, 1, 1]" :position="[0, 10, 2]" /> |
| 27 | + <CuboidCollider :args="[1, 1, 1]" :position="[0, 10, -2]" /> |
| 28 | + <CylinderCollider :args="[1, 1, 1]" :position="[2, 10, 2]" /> |
| 29 | + </RigidBody> |
| 30 | + |
| 31 | + <RigidBody collider="cuboid"> |
| 32 | + <BallCollider :args="[1, 1, 1]" :position="[0, 15, 0]" /> |
| 33 | + |
| 34 | + <TresMesh :position="[0, 15, 0]"> |
| 35 | + <TresTorusGeometry /> |
| 36 | + <TresMeshNormalMaterial /> |
| 37 | + </TresMesh> |
| 38 | + </RigidBody> |
| 39 | + |
| 40 | + <RigidBody type="fixed"> |
| 41 | + <TresMesh :position="[0, 0, 0]"> |
| 42 | + <TresPlaneGeometry :args="[20, 20, 20]" :rotate-x="-Math.PI / 2" /> |
| 43 | + <TresMeshBasicMaterial color="#f4f4f4" /> |
| 44 | + </TresMesh> |
| 45 | + </RigidBody> |
| 46 | + </Physics> |
| 47 | + </Suspense> |
| 48 | + </TresCanvas> |
| 49 | +</template> |
0 commit comments