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: 350

Views: 706

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: Angle Reflector
Rating: 5
Filesize: 17.99 kB
Downloads: 93
Comments: 0
Ratings: 1
Date added: 2015/05/03 05:24:23
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Sim not running , angle working [2.1.0+]
Rating: 5
Filesize: 41.54 kB
Downloads: 214
Comments: 2
Ratings: 1
Date added: 2013/05/13 15:00:48
Made with: Algodoo before v1.8.5
Rating: rated 5
download
Title: Gyroscope
Rating: 6.4
Filesize: 65.09 kB
Downloads: 1173
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: 4787
Comments: 19
Ratings: 23
Date added: 2009/05/04 04:59:10
Made with: Phun
Rating: rated 8.1
download
Title: Nuke Launcher
Rating: 5
Filesize: 444.86 kB
Downloads: 608
Comments: 1
Ratings: 1
Date added: 2017/08/21 14:29:51
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Artillery
Rating: 6.9167
Filesize: 35.16 kB
Downloads: 456
Comments: 7
Ratings: 6
Date added: 2009/11/08 04:56:00
Made with: Algodoo before v1.8.5
Rating: rated 6.9
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