Simple question, but I’m not sure if it is possible.
So the .sleep thing for physics impostors, I’m using them to prevent stuff from moving on slopes. But, the .sleep locks rotation and translation, and I need the rotation to work.
Is it possible to do .sleep with rotation still being possible?
Do you have a playground available? Could you try not using sleep but instead manually update any properties you need to stay constant in onBeforeRenderObservable? In this example it seems to work https://playground.babylonjs.com/#7149G4#34 but Im not sure how that might impact movement on a slope.
When not moving, you can’t look left or right because of .sleep. The little console box shows your current linear velocity. The little box underneath tracks if you are inair or not (it’s a variable)
This is a custom player controller as the camera ellipsoid would be had to make jump and slides down slopes. The plan is the when not moving on the slope, you wont slide down.
Ever played CS:GO? Or any FPS ever? You don’t slide down slopes unless if they are too steep that is what I’m trying to make. Here is a helpful video about CS:GO. Some things are irrelevant, but see how source handels objects? If short enough, you teleport to the top of the object. See how smooth the movement is on slopes/stair clipping? That’s my goal.
This also project looks to be using cannon to get character movement working (still suffers from not sticking to ground when hitting the top of a ramp but feels ok)
You could also avoid a physics engine and do raycasts instead and check the normal of the surface you land on to determine how to move the character.
Thanks for the ideas. Turning off the gravity was one thing I had actually tried. the problem was that the player hitbox was a “sphere” (a cube called “sphere”) and when on the slope, gravity would be off, as I would have onoverlap (not exact syntax) for another cube (called “sphere1”) the was bigger than sphere by 0.1, and had no physicsimpostor attached to it. and whenever it was overlapping the slope, if you turned, you would rotate to face down hill. The sphere would be in would be like it was going up an invisible hill.
After a quick search https://www.babylonjs-playground.com/#IFN77Q#26 was the version that I did that in. Yes, it is a sphere. but the physics impostor is a cube. so change the mech to a cube and see what happens. In version #26, left-right look wasn’t done yet (left-right moves the physimpostor, up-down moves the freecamera)
WASD move
mouse look up/down
q/e look left/right
space jump