Skip to content

Commit f17b935

Browse files
fix: NPM configuration, tree-shaking
1 parent fdbdaf1 commit f17b935

File tree

5 files changed

+28
-27
lines changed

5 files changed

+28
-27
lines changed

example/FloatingCharacterControl.png

1.89 MB
Loading

example/Lights.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export default function Lights() {
2121
shadow-camera-right={50}
2222
shadow-camera-bottom={-50}
2323
shadow-camera-left={-50}
24+
name="followLight"
2425
ref={directionalLightRef}
2526
/>
2627
<ambientLight intensity={0.5} />

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ecctrl",
3-
"version": "1.0.30",
3+
"version": "1.0.32",
44
"author": "Erdong Chen",
55
"license": "MIT",
66
"description": "A floating rigibody character controller for R3F",

readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Ecctrl Floating Capsule Character Controller
22

3-
[![Video](https://img.youtube.com/vi/7h4ydBeryK8/0.jpg)](https://www.youtube.com/watch?v=7h4ydBeryK8)
3+
[![screenshot](example/FloatingCharacterControl.png)](https://character-control.vercel.app/)
44

55
[Pmndrs/ecctrl](https://github.com/pmndrs/ecctrl) is a simple web based character controller build on [react-three-fiber](https://github.com/pmndrs/react-three-fiber) and [react-three-rapier](https://github.com/pmndrs/react-three-rapier). It provides a playground demo where you can experience the following features:
66

@@ -159,7 +159,7 @@ props: {
159159
// AutoBalance Force setups
160160
autoBalance: true, // Enable auto-balance
161161
autoBalanceSpringK: 0.3, // Auto-balance spring constant
162-
autoBalanceDampingC: 0.02, // Auto-balance damping coefficient
162+
autoBalanceDampingC: 0.03, // Auto-balance damping coefficient
163163
autoBalanceDampingOnY: 0.02, // Auto-balance damping on Y-axis
164164
// Animation temporary setups
165165
animated: false, // Enable animation

src/Ecctrl.tsx

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export default function Ecctrl({
6363
// AutoBalance Force setups
6464
autoBalance = true,
6565
autoBalanceSpringK = 0.3,
66-
autoBalanceDampingC = 0.02,
66+
autoBalanceDampingC = 0.03,
6767
autoBalanceDampingOnY = 0.02,
6868
// Animation temporary setups
6969
animated = false,
@@ -101,85 +101,85 @@ export default function Ecctrl({
101101
"Character Controls",
102102
{
103103
maxVelLimit: {
104-
value: 2.5,
104+
value: maxVelLimit,
105105
min: 0,
106106
max: 10,
107107
step: 0.01,
108108
},
109109
turnVelMultiplier: {
110-
value: 0.2,
110+
value: turnVelMultiplier,
111111
min: 0,
112112
max: 1,
113113
step: 0.01,
114114
},
115115
turnSpeed: {
116-
value: 15,
116+
value: turnSpeed,
117117
min: 5,
118118
max: 30,
119119
step: 0.1,
120120
},
121121
sprintMult: {
122-
value: 2,
122+
value: sprintMult,
123123
min: 1,
124124
max: 5,
125125
step: 0.01,
126126
},
127127
jumpVel: {
128-
value: 4,
128+
value: jumpVel,
129129
min: 0,
130130
max: 10,
131131
step: 0.01,
132132
},
133133
jumpForceToGroundMult: {
134-
value: 5,
134+
value: jumpForceToGroundMult,
135135
min: 0,
136136
max: 80,
137137
step: 0.1,
138138
},
139139
slopJumpMult: {
140-
value: 0.25,
140+
value: slopJumpMult,
141141
min: 0,
142142
max: 1,
143143
step: 0.01,
144144
},
145145
sprintJumpMult: {
146-
value: 1.2,
146+
value: sprintJumpMult,
147147
min: 1,
148148
max: 3,
149149
step: 0.01,
150150
},
151151
airDragMultiplier: {
152-
value: 0.2,
152+
value: airDragMultiplier,
153153
min: 0,
154154
max: 1,
155155
step: 0.01,
156156
},
157157
dragDampingC: {
158-
value: 0.15,
158+
value: dragDampingC,
159159
min: 0,
160160
max: 0.5,
161161
step: 0.01,
162162
},
163163
accDeltaTime: {
164-
value: 8,
164+
value: accDeltaTime,
165165
min: 0,
166166
max: 50,
167167
step: 1,
168168
},
169169
rejectVelMult: {
170-
value: 4,
170+
value: rejectVelMult,
171171
min: 0,
172172
max: 10,
173173
step: 0.1,
174174
},
175175
moveImpulsePointY: {
176-
value: 0.5,
176+
value: moveImpulsePointY,
177177
min: 0,
178178
max: 3,
179179
step: 0.1,
180180
},
181181
camFollowMult: {
182-
value: 11,
182+
value: camFollowMult,
183183
min: 0,
184184
max: 15,
185185
step: 0.1,
@@ -213,7 +213,7 @@ export default function Ecctrl({
213213
z: 0,
214214
},
215215
rayHitForgiveness: {
216-
value: 0.1,
216+
value: rayHitForgiveness,
217217
min: 0,
218218
max: 0.5,
219219
step: 0.01,
@@ -232,13 +232,13 @@ export default function Ecctrl({
232232
step: 0.01,
233233
},
234234
springK: {
235-
value: 2,
235+
value: springK,
236236
min: 0,
237237
max: 5,
238238
step: 0.01,
239239
},
240240
dampingC: {
241-
value: 0.2,
241+
value: dampingC,
242242
min: 0,
243243
max: 3,
244244
step: 0.01,
@@ -274,13 +274,13 @@ export default function Ecctrl({
274274
},
275275
slopeRayDir: { x: 0, y: -1, z: 0 },
276276
slopeUpExtraForce: {
277-
value: 0.4,
277+
value: slopeUpExtraForce,
278278
min: 0,
279279
max: 5,
280280
step: 0.01,
281281
},
282282
slopeDownExtraForce: {
283-
value: 0.5,
283+
value: slopeDownExtraForce,
284284
min: 0,
285285
max: 5,
286286
step: 0.01,
@@ -303,19 +303,19 @@ export default function Ecctrl({
303303
value: true,
304304
},
305305
autoBalanceSpringK: {
306-
value: 1.2,
306+
value: autoBalanceSpringK,
307307
min: 0,
308308
max: 5,
309309
step: 0.01,
310310
},
311311
autoBalanceDampingC: {
312-
value: 0.04,
312+
value: autoBalanceDampingC,
313313
min: 0,
314314
max: 0.1,
315315
step: 0.001,
316316
},
317317
autoBalanceDampingOnY: {
318-
value: 0.02,
318+
value: autoBalanceDampingOnY,
319319
min: 0,
320320
max: 0.1,
321321
step: 0.001,
@@ -565,7 +565,7 @@ export default function Ecctrl({
565565
if (followLight) {
566566
dirLight = characterModelRef.current.parent.parent.children.find(
567567
(item) => {
568-
return item.type === "DirectionalLight";
568+
return item.name === "followLight";
569569
}
570570
) as THREE.DirectionalLight;
571571
}

0 commit comments

Comments
 (0)