pmndrs / ecctrl

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

How to define the character/player collision box/cuboid? #56

Open campbellgoe opened 5 months ago

campbellgoe commented 5 months ago

I have a custom character model (who will have animations at a later date) I visualise the cuboid with a Box. I add the CuboidCollider inside Ecctrl. The player finds the floor very bouncy and flies into the sky.

<Ecctrl debug ref={ecctrlRef} autoBalance={false} animated position={pos} jumpVel={0}>
    {/* <EcctrlAnimation characterURL={characterURL} animationSet={animationSet}> */}
    <CuboidCollider args={[1,2.15,1]} mass={0} position={[0,0.5,0]}/>
    <Box args={[1,2.15,1]} position={[0,0.5,0]} />
    <BaseMale scale={0.8} position={[0,-0.9,0]}/>
    {/* </EcctrlAnimation> */}
  </Ecctrl>

Screenshot 2024-05-04 075608

campbellgoe commented 5 months ago

Also, my character origin point as it its feet. When I first imported it, he was floating.

campbellgoe commented 5 months ago

To be honest, this problem goes away when removing debug from Ecctrl.

It's designed to apply a bunch of values or something but this debug doesn't help then does it.

Surely debug should not change anything so it should use defaults right?

Indeed, when I disable autoBalance={false} and apply debug, it applies autoBalance: true due to debug prop.

campbellgoe commented 5 months ago

Next problem, after disabling spinAndFlyToOrbit with autoBalance={false}, the character is floating in the air.

campbellgoe commented 5 months ago

I got it working by changing args and y position. :)

campbellgoe commented 5 months ago

Sorry now there is no friction and the player...this is so confusing to just define a custom character.

campbellgoe commented 5 months ago

Now the floor has geometry which makes it get stuck on cannot walk past. I think I must have the wrong settings. What is floatingDis? image

campbellgoe commented 5 months ago

Fixed with floatingDis=1.5

campbellgoe commented 5 months ago

Now sometimes I load in, character is bouncing off the floor. What settings is this? Bounciness?

campbellgoe commented 4 months ago

I tried changing settings, and maybe it stops the bounciness, but now the floor has no friction. Please help.

campbellgoe commented 4 months ago

OK well the best way i could get it when your character origin point is at its feet, was with this but the bounciness is a problem here, not friction. debug doesn't help.


<Ecctrl dampingC={0.5} floatingDis={1.5} ref={ecctrlRef} autoBalance={false} animated position={pos} jumpVel={0}>
    {/* <EcctrlAnimation characterURL={characterURL} animationSet={animationSet}> */}
    <CuboidCollider args={[0.5, 1.9, 0.2]} mass={0} position-y={-0.35} />
    {/* <Box args={[0.5,1.9,0.2]} position-y={-0.35} />  */}
    <BaseCharacter character={character} scale={0.8} position-y={-1.9} />
    {/* </EcctrlAnimation> */}
</Ecctrl>```
campbellgoe commented 4 months ago

Ahh bounciness is gone when reducing dampingC fro 0.5 to 0.1 (trial and error)

bass3l commented 2 days ago

Hey @campbellgoe, huge thanks for pointing out these problems and what parameters you tweaked to overcome them! it help me a lot with something similar. It's kinda hard to use a custom model! Cheers mate!