Jump to content

BabylonJS Dynamic Terrain Collision fps issue


satguru
 Share

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.

 

Link to comment
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!!

Link to comment
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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...