I have play when he jump, or jump from obstacle, he seems like it just flying, in physics setting, u can apply for all bodies, but i need for specific and specific, i asked chatgpt it give me this
// get the player's rigidbody component
var rigidbody = playerEntity.rigidbody;
// calculate the direction of gravity
var gravity = new pc.Vec3();
app.systems.rigidbody.gravity.grab(gravity).normalize();
// check if the player is in the air (not grounded)
if (!grounded) {
// apply a force in the opposite direction of gravity to make the player fall
rigidbody.applyForce(gravity.scale(-1.0).scale(fallForce));
}
But when i add, i have problem with getting gravity, so i tried, to apply force, for the y in -4, but nothing and after few second, screen becomes just black.
So how apply gravity for my player when not grounded?
Tried this
var gravity = this.reuseVec3.set(-3, -3, -3);
this.entity.rigidbody.applyForce(gravity.scale(this.airGravity));
But after this, i got bugs if set like 10k(cause 1k is almost nothing), i got like bounce teleporting, and ofc, go outside any collision and rigid bodies