Skip to content

Commit

Permalink
Merge pull request #52 from Byongho96/master
Browse files Browse the repository at this point in the history
release
  • Loading branch information
Byongho96 authored Jan 16, 2025
2 parents 1e6493b + f409640 commit 71824cf
Show file tree
Hide file tree
Showing 24 changed files with 672 additions and 24 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ Promise.all( [
gltfLoader.loadAsync( 'collision-world.glb' ),
gltfLoader.loadAsync( 'x-bot.glb' ),
gltfLoader.loadAsync( 'ani-idle.glb' ),
gltfLoader.loadAsync( 'run_forward.glb' ),
gltfLoader.loadAsync( 'ani-forward.glb' ),
gltfLoader.loadAsync( 'ani-forward-fast.glb' ),
gltfLoader.loadAsync( 'ani-jump-up.glb' ),
gltfLoader.loadAsync( 'ani-land.glb' ),
gltfLoader.loadAsync( 'ani-fall.glb' )
Expand Down
2 changes: 1 addition & 1 deletion public/docs/api/core/PhysicsControls.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ <h3>[property:Number landTimeThreshold]</h3>

<h3>[property:Number landTolerance]</h3>
<p>
The distance tolerance for landing detection, measured as the vertical distance from the ground surface. Default is `0.2`.
The distance tolerance for landing detection, measured as the vertical distance from the ground surface. Default is `0.6`.
</p>

<h3>[property:Number maxFallSpeed]</h3>
Expand Down
3 changes: 1 addition & 2 deletions public/docs/api/first-person/FPKeyDragControls.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ <h2>Mixins</h2>
<h3>[page:KeyboardMixin KeyboardMixin]</h3>

<p>
Provide Keyboard API for controlling the object.<br/>
`keyToActions` is overwritten:
Provide Keyboard API for controlling the object.
</p>

<h3>[page:DragMixin DragMixin]</h3>
Expand Down
3 changes: 1 addition & 2 deletions public/docs/api/first-person/FPKeyPointerLockControls.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ <h2>Mixins</h2>
<h3>[page:KeyboardMixin KeyboardMixin]</h3>

<p>
Provide Keyboard API for controlling the object.<br/>
`keyToActions` is overwritten:
Provide Keyboard API for controlling the object.
</p>

<h3>[page:PointerLockMixin PointerLockMixin]</h3>
Expand Down
97 changes: 97 additions & 0 deletions public/docs/api/mixins/GyroMixin.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<base href="../../" />
<script src="page.js"></script>
<link type="text/css" rel="stylesheet" href="page.css" />
</head>
<body>
<h1>[name]</h1>

<p class="desc">
A mixin that extends `FirstPersonControls` to add device orientation-based controls. This mixin uses device gyroscope data to control actions along the X, Y, and Z axes, enabling motion-based interactions.
</p>

<h2>Constructor</h2>

<h3>[name]( [param:FirstPersonControls base] )</h3>
<p>
[page:FirstPersonControls base] — A class that extends `FirstPersonControls`.
</p>

<h2>Properties</h2>

<h3>[property:Array gyroXActions]</h3>
<p>
An array of actions triggered by gyroscope movement along the X-axis. Default is `['MOVE_BACKWARD']`.
</p>

<h3>[property:Number gyroXOffset]</h3>
<p>
Reference value for the gyroscope's X-axis orientation. Default: `0`.
</p>

<h3>[property:Number gyroXMultiplier]</h3>
<p>
The multiplier for the x-axis orientation. Default: `0.1`.
</p>

<h3>[property:Array gyroYActions]</h3>
<p>
An array of actions triggered by gyroscope movement along the Y-axis. Default is `['MOVE_RIGHTWARD']`.
</p>

<h3>[property:Number gyroYOffset]</h3>
<p>
Reference value for the gyroscope's Y-axis orientation. Default: `0`.
</p>

<h3>[property:Number gyroYMultiplier]</h3>
<p>
The multiplier for the y-axis orientation. Default: `0.1`.
</p>

<h3>[property:Array gyroZActions]</h3>
<p>
An array of actions triggered by gyroscope movement along the Z-axis. Default is `[]`.
</p>

<h3>[property:Number gyroZOffset]</h3>
<p>
Reference value for the gyroscope's Z-axis orientation. Default: `0`.
</p>


<h3>[property:Number gyroZMultiplier]</h3>
<p>
The multiplier for the z-axis orientation. Default: `0.1`.
</p>

<h3>[property:Boolean needsResetOrientation]</h3>
<p>
Determines whether the reference values for orientation (`gyroXOffset`, `gyroYOffset`, `gyroZOffset`) should be reset on the next device orientation event. Default: `true`.
</p>

<h2>Methods</h2>

<h3>[method:void connect]()</h3>
<p>
Connects the drag functionality by adding event listeners.
</p>

<h3>[method:void disconnect]()</h3>
<p>
Disconnects the drag functionality by removing event listeners.
</p>

<h3>[method:void dispose]()</h3>
<p>
Disposes of the drag functionality by cleaning up event listeners and resources.
</p>

<h2>Source</h2>

<p>[link:https://github.com/Byongho96/three-game-controls/blob/master/src/mixins/GyroMixin.ts mixins/GyroMixin.ts]</p>
</body>
</html>
5 changes: 2 additions & 3 deletions public/docs/api/third-person/TPKeyDragControls.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,9 @@ <h2>Mixins</h2>
<h3>[page:KeyboardMixin KeyboardMixin]</h3>

<p>
Provide Keyboard API for controlling the object.<br/>
`keyToActions` is overwritten:
Provide Keyboard API for controlling the object.
</p>

<h3>[page:DragMixin DragMixin]</h3>

<p>
Expand Down
3 changes: 1 addition & 2 deletions public/docs/api/third-person/TPKeyPointerLockControls.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ <h2>Mixins</h2>
<h3>[page:KeyboardMixin KeyboardMixin]</h3>

<p>
Provide Keyboard API for controlling the object.<br/>
`keyToActions` is overwritten:
Provide Keyboard API for controlling the object.
</p>

<h3>[page:PointerLockMixin PointerLockMixin]</h3>
Expand Down
1 change: 1 addition & 0 deletions public/docs/list.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

"Mixins": {
"DragMixin": "api/mixins/DragMixin",
"GyroMixin": "api/mixins/GyroMixin",
"KeyboardMixin": "api/mixins/KeyboardMixin",
"PointerLockMixin": "api/mixins/PointerLockMixin"
}
Expand Down
2 changes: 1 addition & 1 deletion public/docs/manual/Quick-Start.html
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ <h2>ThirdPersonControls</h2>
gltfLoader.loadAsync( 'collision-world.glb' ),
gltfLoader.loadAsync( 'x-bot.glb' ),
gltfLoader.loadAsync( 'ani-idle.glb' ),
gltfLoader.loadAsync( 'run_forward.glb' ),
gltfLoader.loadAsync( 'ani-forward.glb' ),
gltfLoader.loadAsync( 'ani-forward-fast.glb' ),
gltfLoader.loadAsync( 'ani-jump-up.glb' ),
gltfLoader.loadAsync( 'ani-land.glb' ),
gltfLoader.loadAsync( 'ani-fall.glb' )
Expand Down
3 changes: 2 additions & 1 deletion public/examples/files.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"ThirdPerson": [
"third-person_keyboard_controls",
"third-person_mousedrag_controls",
"third-person_pointerlock_controls"
"third-person_pointerlock_controls",
"third-person_gyroscope_mixins"
]
}
2 changes: 1 addition & 1 deletion public/examples/first-person_keyboard_controls.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"imports": {
"three": "https://cdn.jsdelivr.net/npm/[email protected]/build/three.module.js",
"three/addons/": "https://cdn.jsdelivr.net/npm/[email protected]/examples/jsm/",
"three-game-controls": "https://cdn.jsdelivr.net/npm/three-game-controls/dist/bundle.esm.js"
"three-game-controls": "../../dist/bundle.esm.js"
}
}
</script>
Expand Down
2 changes: 1 addition & 1 deletion public/examples/first-person_mousedrag_controls.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"imports": {
"three": "https://cdn.jsdelivr.net/npm/[email protected]/build/three.module.js",
"three/addons/": "https://cdn.jsdelivr.net/npm/[email protected]/examples/jsm/",
"three-game-controls": "https://cdn.jsdelivr.net/npm/three-game-controls/dist/bundle.esm.js"
"three-game-controls": "../../dist/bundle.esm.js"
}
}
</script>
Expand Down
2 changes: 1 addition & 1 deletion public/examples/first-person_pointerlock_controls.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"imports": {
"three": "https://cdn.jsdelivr.net/npm/[email protected]/build/three.module.js",
"three/addons/": "https://cdn.jsdelivr.net/npm/[email protected]/examples/jsm/",
"three-game-controls": "https://cdn.jsdelivr.net/npm/three-game-controls/dist/bundle.esm.js"
"three-game-controls": "../../dist/bundle.esm.js"
}
}
</script>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion public/examples/shoot/first-person_pointerlock_shooting.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />
<link type="text/css" rel="stylesheet" href="../main.css" />
<link type="text/css" rel="stylesheet" href="./styles.css" />
</head>
<body>
<div id="info">Kill the monsters by clicking on them</div>
Expand All @@ -16,7 +17,7 @@
"imports": {
"three": "https://cdn.jsdelivr.net/npm/[email protected]/build/three.module.js",
"three/addons/": "https://cdn.jsdelivr.net/npm/[email protected]/examples/jsm/",
"three-game-controls": "https://cdn.jsdelivr.net/npm/three-game-controls/dist/bundle.esm.js"
"three-game-controls": "../../../dist/bundle.esm.js"
}
}
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />
<link type="text/css" rel="stylesheet" href="main.css" />
<link type="text/css" rel="stylesheet" href="./styles.css" />
</head>
<body>
<div id="info">Kill the monsters by clicking on them</div>
Expand All @@ -16,7 +17,7 @@
"imports": {
"three": "https://cdn.jsdelivr.net/npm/[email protected]/build/three.module.js",
"three/addons/": "https://cdn.jsdelivr.net/npm/[email protected]/examples/jsm/",
"three-game-controls": "https://cdn.jsdelivr.net/npm/three-game-controls/dist/bundle.esm.js"
"three-game-controls": "../../../dist/bundle.esm.js"
}
}
</script>
Expand Down
29 changes: 29 additions & 0 deletions public/examples/shoot/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#cross {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 50px;
height: 50px;
pointer-events: none;
}
#cross::before,
#cross::after {
content: '';
position: absolute;
background-color: rgba(68, 68, 68, 0.61);
}
#cross::before {
top: 0;
left: 50%;
transform: translateX(-50%);
width: 4px;
height: 100%;
}
#cross::after {
top: 50%;
left: 0;
transform: translateY(-50%);
width: 100%;
height: 4px;
}
Loading

0 comments on commit 71824cf

Please sign in to comment.