Search the Community
Showing results for tags 'trigonometry'.
Found 2 results
Convergence posted a topic in Questions & AnswersFor my new project I ideally need to be able to create simple hipped, gabled, and pointed from any arbitrary shape given (by JSON). Pointed and dome roofs are easy enough since the shape just converges to one point upwards, but I can't figure out gabled and hipped roofs just yet.. See attachment for a visual. Does anyone have any idea how to do this? The input would be an array of (clockwise) Vector2's describing the outline of the building. Here's a PG to play with, obviously I didn't find any solution yet myself https://www.babylonjs-playground.com/#AT8MET
Please excuse what I'm sure is a very novice question, but I've been all over Google and I can't find what I'm looking for. I'm attempting to detect when a sprite is no longer being moved by the player - e.g. when the player releases the key. I'd like to do this by seeing how the sprite is moving, rather than relying on detecting the keypress or other input, as the sprite has some drag associated with it and I'd like to play a 'slowdown' animation as the drag slows the sprite. I'm also attempting to keep as much encapsulated in my prefab as possible and thus I don't want to put anything in the main game's update method to initiate the slowdown function. So, what I'd like to do is detect that the sprite is no longer moving at the veliocity I'd expect it to if the move functions were being called... The thought being that the velocity is constant while the key is down, and begins to reduce when the key is released - however because the sprite can be at any angle, I can't predict what the velocity will be without understanding how it's calcuated. So, unless someone has another suggestion as to how I might detect that the sprite is slowing down, in any direction - would someone be able to give me some schooling in what I assume is very basic trigonometry? Thanks!