Skip to content

Get player position #94

Answered by ErdongChen-Andrew
timhc22 asked this question in Q&A
Aug 26, 2024 · 1 comments · 3 replies
Discussion options

You must be logged in to vote
useFrame(() => {
    if (ecctrlRef.current && ecctrlRef.current.translation().y < -10) {
      ecctrlRef.current.setTranslation({ x: 0, y: 3, z: 0 });
      ecctrlRef.current.setLinvel({ x: 0, y: 0, z: 0 });
      ecctrlRef.current.setAngvel({ x: 0, y: 0, z: 0 });
    }
  });

#48 This is for better performance, not to prevent falling.
Here are a few other things you could try:

  1. Place the map component below the Ecctrl component.
  2. Make the floor thicker.
  3. Pause the physics (or gravity) until the map is fully loaded.
  4. Position the character slightly higher.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@timhc22
Comment options

@ErdongChen-Andrew
Comment options

Answer selected by timhc22
@timhc22
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants