Browse Search Popular Register Upload Rules User list Login:
Search:
Angle gun with bug

Image:
screenshot of the scene

Author: Jelmerholland

Group: Default

Filesize: 13.24 kB

Date added: 2009-07-10

Rating: 5

Downloads: 522

Views: 911

Comments: 5

Ratings: 1

Times favored: 0

Made with: Phun

Tags:

Scene tag

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:s Because I want this gun for my next mouse controlled ufo
Please log in to rate this scene
edit
Similar scenes
Title: stepper motor
Rating: 5.7778
Filesize: 22.29 kB
Downloads: 413
Comments: 2
Ratings: 3
Date added: 2009/12/06 21:35:11
Made with: Algodoo before v1.8.5
Rating: rated 5.8
download
Title: Sim not running , angle working [2.1.0+]
Rating: 5
Filesize: 41.54 kB
Downloads: 286
Comments: 2
Ratings: 1
Date added: 2013/05/13 15:00:48
Made with: Algodoo before v1.8.5
Rating: rated 5
download
Title: Little David - Mortar 800mm
Rating: 5
Filesize: 420.55 kB
Downloads: 958
Comments: 0
Ratings: 1
Date added: 2023/04/23 09:30:04
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Gyroscope
Rating: 6.4
Filesize: 65.09 kB
Downloads: 1427
Comments: 1
Ratings: 4
Date added: 2009/04/28 12:55:48
Made with: Phun
Rating: rated 6.4
download
Title: Artillery Game
Rating: 8.1003
Filesize: 377.62 kB
Downloads: 5499
Comments: 19
Ratings: 23
Date added: 2009/05/04 04:59:10
Made with: Phun
Rating: rated 8.1
download
Title: P.H.U.N. Angle Tracker
Rating: 6.1111
Filesize: 10.31 kB
Downloads: 557
Comments: 0
Ratings: 3
Date added: 2009/07/05 02:07:45
Made with: Phun
Rating: rated 6.1
download
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