ecctrl icon indicating copy to clipboard operation
ecctrl copied to clipboard

First person camera controls are faulty

Open campbellgoe opened this issue 1 year ago • 7 comments

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?

campbellgoe avatar May 16 '24 20:05 campbellgoe

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

ErdongChen-Andrew avatar May 18 '24 00:05 ErdongChen-Andrew

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.

campbellgoe avatar May 18 '24 11:05 campbellgoe

@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.

NicolasBrondin avatar Jun 06 '24 15:06 NicolasBrondin

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~

RayLee666 avatar Aug 07 '24 06:08 RayLee666

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

ErdongChen-Andrew avatar Aug 07 '24 20:08 ErdongChen-Andrew

I'm working on a first person view, but it seems like autoBalance={false} has no effect. In the debug menu it looks like, autoBalance is always enabled. Is there anyway a Tutorial for using your player controller as a first-person-view?

autobalance

 <KeyboardControls map={keyboardMap}>
          <Ecctrl
            debug={true}
            dampingC={0.1}
            floatingDis={1.5}
            autoBalance={false}
            animated
            jumpVel={0}
            maxVelLimit={2.5}
            camInitDis={-0.01}
            camMinDis={-0.01}
            camFollowMult={100}
            turnVelMultiplier={1}
            turnSpeed={30}
            camLerpMult={1000}
            mode={"CameraBasedMovement"}
          />
        </KeyboardControls>

murcoder avatar Oct 04 '24 14:10 murcoder