swift502 / Sketchbook

3D playground built on three.js and cannon.js.

Home Page:https://jblaha.art/sketchbook/latest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Terrain slope + camera collision?

Thundros opened this issue · comments

Hi, @swift502 ! :) I'd like to say 1st that this project is AWESOME! Please do keep up the GREAT work! :D Lastly, can you please add an example of how to add slope collision based on the steepness of the terrain? and add collision to the camera where it can't go through the terrain?

Thank You & once again swift, keep up the GREAT work!

Hi,

Thanks, glad you like this projcet.
Both examples would be possible, but this project is on a hiatus currently.

If by slope collision you mean "sliding down a slope when it is too steep" then yes that's possible, but not easily editable as a single parameter right now. So it would need some work. It's based on the distance between player's collision capsule's bottom and the distance of player's "feet raycast".

Camera collision isn't implemented at all. I do have an idea of how to do it though. Just a simple raycast from the camera's orbit center to the camera's actual position. If the raycast hits anything you position the camera there.

That's a common thread with this projects. I have a million ideas and know how to do cool stuff in principle, and would love to do these things, but I kinda moved on to other projects. I find it hard to keep working on the same thing for long stretches at a time. (More than half a year)

So I might do these some day. I don't know. Hopefully.
In the meantime I'd encourage you to do it yourself. I'll be happy to merge your changes into this repo if they're meaningful. 👍