Camera Gravity Problem

made a simple code :

https://www.babylonjs-playground.com/indexStable.html#ILJXTY#6*

Why camera gravity is not applied if camera don’t move?

Press “J”, camera gravity will not applied, if you don’t move after you can wait it will never apply without moving cam, when you moving cam with Z camera gravity is just applied for a moment if you up z its the same problem.

I’ve had this problem.

add the line camera._needMoveForGravity = true;

It’s backwards, I know.

https://www.babylonjs-playground.com/indexStable.html#ILJXTY#7

Btw, welcome to the community! For future reference the “bugs” category is for Babylon.js bugs, while the “questions” category is what this type of topic would fall under. Just for future reference!

That’s weird, this property isn’t in the API doc: Babylon.js Documentation

Thank you Givo for your quick answer :slight_smile: , its work well.

I didn’t see this property because i didn’t find it in the documentation like Vinc3r.
And its a private property so my typescript editor don’t show it.

For the persons who uses typescript if you have the same problem you need to cast your camera in <any> to modify the property because its a private property for example like that :

(<any>cam)._needMoveForGravity = true;

Once again thank you Givo :slight_smile:

2 Likes

sure no problem.

Oh, one more thing. for you code

use the tilde key (upper left hand corner) to add `` to it so it does this:
( cam)._needMoveForGravity = true;

EDIT: you changed it while I was typing!

Do you know how to mark a solution?
click the little check mark on the post that was the solution to mark it.

I clicked it :slight_smile:

What? why does it say you post is 3 minutes old? Yours should be before mine.

For me it appears like that :

it updated. Weird bug though.

Do you know how to mark a solution?