Skip to content

Commit 408932b

Browse files
update point to move naming
1 parent 9b05ff9 commit 408932b

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

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.57",
3+
"version": "1.0.58",
44
"author": "Erdong Chen",
55
"license": "MIT",
66
"description": "A floating rigibody character controller for R3F",

src/Ecctrl.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ const Ecctrl = forwardRef<RapierRigidBody, EcctrlProps>(({
520520
let isPointMoving = false;
521521
const crossVector = useMemo(() => new THREE.Vector3(), []);
522522
const pointToPoint = useMemo(() => new THREE.Vector3(), []);
523-
const getPointToMovePoint = useGame((state) => state.getPointToMovePoint);
523+
const getMoveToPoint = useGame((state) => state.getMoveToPoint);
524524
const bodySensorRef = useRef<Collider>();
525525
const handleOnIntersectionEnter = () => {
526526
isBodyHitWall = true
@@ -719,7 +719,7 @@ const Ecctrl = forwardRef<RapierRigidBody, EcctrlProps>(({
719719
* Point-to-move function
720720
*/
721721
const pointToMove = (delta: number, slopeAngle: number, movingObjectVelocity: THREE.Vector3) => {
722-
const moveToPoint = getPointToMovePoint().pointToMovePoint;
722+
const moveToPoint = getMoveToPoint().moveToPoint;
723723
if (moveToPoint) {
724724
pointToPoint.set(moveToPoint.x - currentPos.x, 0, moveToPoint.z - currentPos.z)
725725
crossVector.crossVectors(pointToPoint, vectorZ)
@@ -967,7 +967,7 @@ const Ecctrl = forwardRef<RapierRigidBody, EcctrlProps>(({
967967
modelQuat,
968968
delta * turnSpeed
969969
);
970-
970+
971971
// If autobalance is off, rotate character model itself
972972
if (!autoBalance) {
973973
if (getCameraBased().isCameraBased) {

src/stores/useGame.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const useGame = /* @__PURE__ */ create(
88
/**
99
* Point to move point
1010
*/
11-
pointToMovePoint: null as THREE.Vector3,
11+
moveToPoint: null as THREE.Vector3,
1212

1313
/**
1414
* Check is camera based movement
@@ -153,15 +153,15 @@ export const useGame = /* @__PURE__ */ create(
153153
/**
154154
* Set/get point to move point
155155
*/
156-
setPointToMovePoint: (point: THREE.Vector3) => {
156+
setMoveToPoint: (point: THREE.Vector3) => {
157157
set(() => {
158-
return { pointToMovePoint: point };
158+
return { moveToPoint: point };
159159
});
160160
},
161161

162-
getPointToMovePoint: () => {
162+
getMoveToPoint: () => {
163163
return {
164-
pointToMovePoint: get().pointToMovePoint,
164+
moveToPoint: get().moveToPoint,
165165
};
166166
},
167167

@@ -199,15 +199,15 @@ export type AnimationSet = {
199199
};
200200

201201
type State = {
202-
pointToMovePoint: THREE.Vector3;
202+
moveToPoint: THREE.Vector3;
203203
isCameraBased: boolean;
204204
curAnimation: string;
205205
animationSet: AnimationSet;
206206
initializeAnimationSet: (animationSet: AnimationSet) => void;
207207
reset: () => void;
208-
setPointToMovePoint: (point: THREE.Vector3) => void;
209-
getPointToMovePoint: () => {
210-
pointToMovePoint: THREE.Vector3;
208+
setMoveToPoint: (point: THREE.Vector3) => void;
209+
getMoveToPoint: () => {
210+
moveToPoint: THREE.Vector3;
211211
}
212212
setCameraBased: (isCameraBased: boolean) => void;
213213
getCameraBased: () => {

0 commit comments

Comments
 (0)