Sign in to follow this  
satguru

BabylonJS Dynamic Terrain Collision fps issue

Recommended Posts

@jerome 

I took your original document example

https://www.babylonjs-playground.com/#FJNR5#190

and turned on collision and gravity

https://www.babylonjs-playground.com/#FJNR5#210

When you move the camera around the fps drops from 60 to around 30

Is there anything which we can do to prevent this?

Also camera tends to get stuck from time to time.

 

Share this post


Link to post
Share on other sites

nice pg @waverider

I am trying to use Dynamic terrain with my Character Controller.

Here I have an ArcRotateCamera following a Character.

If i turn on  checkCollosion on the camera, the FPS drops to 21-25.

If I turn it off, FPS goes back up to 60,

Weird.

The camera does not collide with anything. It just follows the character.

The character has collision turned on.

You would think  collision on the character would make a difference.

After all it is the character which is colliding with the terrain

But no. It is collision on camera which makes the difference!!

Share this post


Link to post
Share on other sites

the most efficient way to check collisions with a dynamic terrain or any BJS Ground objects (although they aren't the same) keeps to use the methods getHeightAtCoordinates(x, z) and getNormalAtCoordinates(x, z) or getHeithFromMap(x, z) and getNormalFromMap(x, z) depending on the object class

https://www.babylonjs-playground.com/#J6FMJ#7

https://github.com/BabylonJS/Extensions/blob/master/DynamicTerrain/documentation/dynamicTerrainExamples.md

It's hundreds of times fastest.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.