ErdongChen-Andrew / CharacterControl

Floating Capsule Character Controller (Rigibody control)
https://character-control.vercel.app
MIT License
386 stars 52 forks source link

The Player falls through the platform immediately upon opening the Website #12

Open Dhruvisgoat opened 9 months ago

Dhruvisgoat commented 9 months ago

https://github.com/ErdongChen-Andrew/CharacterControl/assets/78818585/0e2096e0-3edc-4229-a010-08c937e94557

ErdongChen-Andrew commented 9 months ago

It seems to be a performance issue. Try opening it on different devices.

Dhruvisgoat commented 9 months ago

Tried running on multiple devices ,and different browsers but the issue still exists .. the problem does get resolve upon reloading multiple times . Is it due to the Map taking more time to load than the Player ?

ErdongChen-Andrew commented 9 months ago

Could be. 🤔 How about this codesandbox: https://codesandbox.io/p/sandbox/ecctrl-w-o-animations-3k3zxt?file=%2Fsrc%2FApp.js%3A38%2C19 It requires less performance

Dhruvisgoat commented 9 months ago

nah same issue with that :(

Dhruvisgoat commented 9 months ago

hey btw after replacing the entire character with a low geometry mesh ,it seemed to work fine :)

ErdongChen-Andrew commented 9 months ago

Good to know that! Seems like i added too much to the demo 😂

Dhruvisgoat commented 9 months ago

btw i noticed few more issues with the codesandbox demo , one that the jump functionality doesn't seem like working and the player keeps on moving infinitesimally upon pressing wasd keys. Whats the possible fix for that 😅

ErdongChen-Andrew commented 9 months ago

Everything is functioning well on my site; I've never encountered that issue.

Dhruvisgoat commented 9 months ago

Sure, btw how did you implement the logic of using a first person camera movement for the touch device , as PointerLockControls do not work for mobile devices , its taking my life to find a solution for that :((

ErdongChen-Andrew commented 9 months ago

I wrote the camera movement myself, allowing me to check for the availability of PointerLock. If it's not available, I use drag and move functionality.

Dhruvisgoat commented 9 months ago

could you mind sharing the code for drag and move functionality or if possible help me with creating a react wrapper for such drag and move controls.

ErdongChen-Andrew commented 9 months ago

You may check the code in useFollowCam.tsx