Search the Community
Showing results for tags 'maths'.
-
Hi All, I'm trying to figure out if there is any functionality in PIXI to find a point on a bezier curve. For example I want to take a spurious global point and find the closest point on a curve. Any help would be greatly appreciated.
-
I was wondering how does bezier cureve drawing works. I know there is function bezierCurveTo(cpX, cpY, cpX2, cpY2, toX, toY) → {PIXI.Graphics} and probably (cpX, cpY) is the start point, (cpX2, cpY2) is the middle control point and (toX, toY) is the ending point. but I got something like: Which is the polygon I drew just before the bezierCurveTo() call. Should I create first polygon and add fill/border to it or what do I do? Are there some official Phaser examples for drawing bezier curves?
- 4 replies
-
- phaser 2.6.1
- graphics
- (and 4 more)
-
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!
- 2 replies
-
- trigonometry
- maths
-
(and 2 more)
Tagged with:
-
Shape position changes depending on the angle of the body in p2js
LordofLolcats posted a topic in 2D
Edit: Problem fixed. My mistake. Never mind.-
- maths
- javascript
-
(and 1 more)
Tagged with:
-
Anyone know how to make a rotatable knob?
Dream Of Sleeping posted a topic in Coding and Game Design
I want to make a rotatable knob. I want the player to be able to click the knob or just outside the knob and then for the knob image's angle to change. But I don't know how to work out what angle it would be. I know it's the angle between the mouse pointer, then center of the knob and then top of the knob that I want. This won't even make a triangle if the angle is large enough so looking at trig tutorials I can't even find anything appropriate. Once again my lack of maths knowledge has failed me. But just so you know it's not for lack of trying. Whenever I try and learn trig, there is something from algebra I don't understand, so I get an algebra book which contains an example using fractions, so I brush up on fractions but it contains some large multiplication problems, so I have to practice that then before you know it i'm back to practicing my times tables and have learned nothing to help with programming. Although I totally know what 7 * 8 is without using google. If anyone can explain, please use as little math jargon as possible and imagine your are explaining to a 10 year old with learning difficulties, or you'll probably just lose me. If anyone can just supply code that I can pretty much copy and paste and get working can have a permanent advertisement in the game for their website or game of choice.