How do I change player (ecctrl chid) starting position in my world and also make the camera start from there?

Open
#66 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

Start with the Ecctrl component props and playerRef usage shown in the issue, then inspect the controller's positioning and camera-target documentation or examples. Done means documenting or demonstrating how to set the player's initial world position and align the starting camera without relying on mesh position.

Written by the indexing model from the issue text.

Description

I have a custom component which i use as my character for the child as shown below, how do I set a custom initial position for this? I tried using the camTargetPos prop but it moved only the camera and not the player. i tried changing the position of the mesh of my player component but whenever I move it it flies off or falls off infinitely. I hope you can help me out with this.

<Ecctrl
ref={playerRef}
floatHeight={0.05}
maxVelLimit={4}
jumpVel={4}
capsuleRadius={0.35}
capsuleHalfHeight={0.105}

          >
            <Player />
          </Ecctrl>
          
          
    This is the mesh for my player component:
          <mesh
    ref={head}
    geometry={bowlCoverGeometry}
    position={[0, 0.01, 0]}
    scale={[0.6, 0.6, 0.6]}
  >
    <meshBasicMaterial color="sienna" />
  </mesh> 
Dominant language
TypeScript
Stars
823
Forks
102
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from pmndrs/ecctrl

All issues in pmndrs/ecctrl

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.