pmndrs / ecctrl

🕹️ A floating rigibody character controller
MIT License
530 stars 63 forks source link

First person camera controls are faulty #63

Open campbellgoe opened 4 months ago

campbellgoe commented 4 months ago

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?

ErdongChen-Andrew commented 4 months ago

I don't quite understand the bug. Do you have any videos?

campbellgoe commented 4 months ago

hmm I can no longer reproduce it. could have been a weird mouse issue but well it was rotating to some other orientation instead of keeping the first person view stable with the mouse.

NicolasBrondin commented 3 months ago

@campbellgoe This can happen if you release your mouse click outside of the browser's window. Then when the cursor comes back on the page, the character rotates even if mouse is not clicked.

Clicking again in the page solves the issue.

RayLee666 commented 1 month ago

20240807_121558.webm

RayLee666 commented 1 month ago

this is aspecific bug to v1.0.88. it makes the first person controller unusable at all v1.0.83 works fine. please fix it~

ErdongChen-Andrew commented 1 month ago

@RayLee666 add this to ecctrl: camLerpMult={1000} I forgot to update the readme