Search the Community
Showing results for tags 'curve'.
-
Hi there, I want to implement a car which can be dragged and is able to turn around corners while being draged so far I only found a posibility to turn in direction of the pointer (eg mouse) but than the car turns before it is even (pixelperfect)clicked too any sugguesstions or helpfull links? thanks:)
-
Hi I'm experimenting with Babylon and currently I'm trying to get a mesh (box) to follow a curve I've created. This part I've managed by borrowing various examples, but what i'd like to do now is make sure the box is always "facing" the direction of movement as it goes along the path. I've tried a few techniques I've found here and elsewhere but I seem to be having trouble making it work. Here's "my" code: http://www.babylonjs-playground.com/#5KA114#11 It's based on an example by @celian-garcia because I was planning on using TweenMax for this and some other animations I have in mind. Once I can get the above working I will then parent a camera to the box and use this as a fly-by-wire animation for my final scene. Would appreciate any help. Cheers
-
Hi guys, Rather a technical question I'm afraid and one that I do have a functional solution to, but wanted to take the opportunity to learn something new. I'm attempting to create the deck of a ship (the Titanic) from blueprints, using a curve3 object to create the outline of the decks (eventually using it to create path points for a polygon mesh/extruded shape, but simply used as line paths for the time being). This works perfectly fine, of course, as the deck plans are completely flat - using the X and Z co-ordinates (in my case) of the curve3 I can match the outline of the decks with reasonable precision. A ship, however, doesn't tend to have flat decks - Titanic being no exception. The decks are curved upwards both forward and aft. One (almost) solution being to create an additional curve depicting the deck on a side (profile) blueprint (containing the same number of points as the aforementioned deck outline). I have written functions to extract the x, y and z points of any given curve3 path, and could pass the x and z data from the deck curve, and the y data from the side profile curve, as arguments to my own custom curve. This would work in theory, if both curves were identical - then the x co-ordinates of the side profile would match perfectly the x co-ordinates of the deck plan's curve. Where the poop deck, for instance, curves around sharply at the stern, the x co-ordinates of the deck outline will get considerably closer together, whereas they won't do so on the deck profile - using my 'solution' would likely result in a very warped deck. My solution to the problem is a simple one - simply line up the two plans and visually adjust the y input of the start, end and control points of the bezier curve function (depicting the deck outline) to incorporate the curve of the deck - which is gentle enough to achieve easily. My curious nature tends to get the better of me, as you all probably know, and leads me to ponder if there is a way to programatically get the x, y or z co-ordinates at any given point of the curve3? Take a simple curve from vector3(10,0,-10) to vector3(50,0,0) - if, for example, I wanted to know the value of z at x:31.265, am I able to get that or calculate that programatically without being a mathematical genius or including a massive number of points and searching the path array for the nearest value?
-
I started working on a game similar to Curve Fever (https://www.youtube.com/watch?v=ojqBnYcxl0c). I’m new to Phaser and Pixijs, so I need advice on how to render a curve on the field. Right now i have two Graphics objects: head (circle using drawCircle()) with arcade physics enabled (to be able to move it around the map tail - static graphics copying head x and y on update drawing a line (lineTo(head.x, head.y) The problem is as you see in the video the grey curve has a texture background. Assuming i have a repeatable PNG with background, how could i map it within the curve that is being drawn? Other question is should I use BitmapData instead of Graphics? I would prefer a lightweight option that would run on older computers. I would also need to be able to detect collisions, I think it's possible to enable it for Graphics but not sure about bitmap.
-
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)
-
I'm creating a mask for my sprite using a Phaser.Graphics object - the mask is a collection of rectangles and circles, and it works fine. I then tried to add a filled bezier curve with the method bezierCurveTo(). If my graphics object is not set as a the mask, I can see the filled curve appear in my graphics. But when I use it as a mask for another sprite, the filled curve does not appear to be part of the shape With mask applied - no bezier curve is seen Plain graphics object, not used as a mask. The filled bezier curve is visible on the left. Is this just a rule that bezier curves can't be used in masks? Or is there some other way to make this work...?
-
Hi guys! I'm trying to develop a road with Phaser (My idea is that a car moves for him). How can I do that when the car is outside is slow? My first test: http://codepen.io/jdnichollsc/pen/YPEeYe Any help is greatly appreciated! Regards, Nicholls
-
Hey Enpu, I write here just to say that this is one of the few times in my life in which there's something that I like A LOT, but there's still very few material about it. Don't misunderstand me, I'm not flaming nor trying to bring you down nor whatever. Just saying that I'm liking Panda.js a LOT. But the demos aren't enough material to make game of different disciplines. There's no material on Internet about Panda.js other than the official site, which gives specific examples, and the API reference. I mean, I want to make a platformer. Kind of a Megaman. But I don't know how to use spritesheet animations, collisions, enemies, etc. I come from GameMaker which has all that already chewed. GameMaker gives you editor for sprites and whatever, gives you GML for scripting which is not SO bad as a language but I wanted even more control over my game. Over code, to be precise, GML has weaknesses, it's not really OOP, data manipulation is not so flexible, etc. Then Javascript is an awesome choice. Your framework looks so versatile, full of features, prollific, etc. but I'm having HARD times trying to do things! Very few things are, let's say "deductible" from your code (which is, thanks God, very read-friendly) but many other ones I just can't guess :S I swear to God that I'd never write this kind of message before googling at least half Internet, so you can give an idea... It would be nice to have tutorials on how to make a platformer, a shooter, a maze, puzzle, networked multiplayer games, etc. I know it's gonna mean a ton of work from you but well, I can't see other way to learn than tutorials from the very creator of this software. Greetings again, Leo. P.S.: I say again, this message is not to be taken as a complain. I just want this engine to trascend, otherwise I wouldn't bother in writing such a letter
-
Hi all, Please find the following link http://collegetomato.com/forDhruva/nanoSWAT/curveMovement/ which I have done using construct2 game engine and it took me almost a week to do this. Considering my programming skill of a designer(who also codes sometimes) it would take more time in Phaser. Can you help me out with a code snippet which simulates the action shown in the link The algorithm I have used is ... I am storing the trails as the player is touching the screen and storing the X,Y, direction (relation between previous consecutive trails) in an array which I am looping through and then changing the Y position of the main Sprite when the X of the next trail is less than the main sprite. ..if the current direction is LEFT to RIGHT.similarly changing the Y position of the main sprite if the X of next trail is greater than the main sprite ..if the current direction is RIGHT to LEFT sorry if the explanation for the algo is crude thanks