pmndrs / pmndrs/ecctrl

First person camera controls are faulty

Open
#63 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
797
Forks
98
Avg merge
8m
Merged PRs (30d)
1

Description

When I go into first person perspective, and move the mouse around, often the camera/character rotate.

const MyEcctrl = forwardRef(({ children, pos, perspective = THIRD_PERSON, props = {} }, ref) => {
  return <Ecctrl
    ref={ref}
    dampingC={0.1}
    floatingDis={1.5} 
    autoBalance={false}
    animated
    position={pos}
    jumpVel={0}
    {...(perspective === FIRST_PERSON ? {
      camInitDis:-0.01,
      camMinDis:-0.01,
      camFollowMult: 100,
      turnVelMultiplier: 1,
      turnSpeed: 10,
      mode: "CameraBasedMovement"
    } : {})}
    {...props}
  >{children}</Ecctrl>
})

Here's my code.

Any idea how to stop this bug?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Start by reproducing the first-person setup from the reported Ecctrl snippet and isolate when mouse movement causes unintended camera or character rotation. Done means first-person mouse movement no longer produces the reported faulty rotation.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, three.js, typescript
Domain
game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.