Search:
Angle gun with bug
 Image: Author: JelmerhollandGroup: DefaultFilesize: 13.24 kBDate added: 2009-07-10Rating: 5Downloads: 351Views: 714Comments: 5Ratings: 1Times favored: 0Made with: PhunTags: Scene tag [scene]26322[/scene] Why doesn't this work? Q: change the motorspeed and let the gun turn to left. Why I have this bug? A: becuz the angle is negative Q: why doesn't it work at the 0 < x < 45 A: .... Q: How can I solve it? A: .... I hope that you can help me Because I want this gun for my next mouse controlled ufo
Similar scenes
 you need to get the angle between 2 points (mousepos, pos) and compare it with the normal-only angle. you sould know how to do the normal only angle, but, it can be simplified if you are only using e. normal, to: math.atan(e.normal(1) / (e.normal(0) + 1)) * 2 because the length of the e.normal vector is always 1. for vectors with variable lengths you need to use the other one. hovewer, ive not managed to think of a math formula to measure the angle betweeen those 2 points. Another thing you should be aware of is that phun measures angles in radians, so, you might need radians and not degrees to do it
 Aha, but the problme is that the bullets allways go to the right.. where the deg are possitive.. I think I have to add 180 or smth like that
 for bullet speed you can use e.normal - no complicated stuff here
 Okay.. but the problem is this.. when the gun is aimed to the left... the gun doesn't work... the speed is allways possitive... never negative... but Can I solve this by e.normal -300 for example??
 actually, e.normal returns the vector of the collision detection in two vectors.You can't go wrong with it, because the distance between the position and the position + the normal is always equal to 1 meter. if you're trying ro get the bullet at a constant 300 m/s rate, it would be "e,normal * 300"(notice the multiplication