Finding 'suitable' horizontal and vertical speed from an angle - android -
im using particle system , have when creates particle passes starting x , y value , angle want shoot particle need have vertical speed , horizontal speed can can?
hack , slash of particle:
particle(int x, int y,int x2,int y2) { this.x = x; this.y = y; this.state = bulletparticle.state_alive; this.widht = max_dimension;//rndint(1, max_dimension); this.height = this.widht; // this.height = rnd(1, max_dimension); this.lifetime = default_lifetime; this.age = 0; this.xv = x2;//(rnddbl(0, max_speed * 2) - max_speed); this.yv = y2;//(rnddbl(0, max_speed * 2) - max_speed); // smoothing out diagonal speed if (xv * xv + yv * yv > max_speed * max_speed) { xv *= 0.7; yv *= 0.7; }
work out how long want particle cross whole of width, or height, use s = 0.5 * * t^2 + v0 * t work out v0, initial speed (take @ equations of motion).
if it's not accelerating or decelerating, can use s = v0 * t ...
Comments
Post a Comment