Laser rotations differ between lasers?

About advanced scenes, and the Thyme scripting language used in Algodoo.

Laser rotations differ between lasers?

Postby ddthj » Thu May 08, 2014 8:42 pm

Once again I am having problems with lasers.

What I have been trying to do is create a tank battle with AI-like tanks. The tank has a "radar" on it that sets scene.my.combatmodeT1 = 1 after it finds/hits an "enemy" (anything that has a color of [1,0,0,1] and on collision layer I). Once it finds an enemy, the combat mode changes, the tank stops normal movement and is Supposed to turn the turret to face the enemy. This only seems to work if the enemy is below the tanks position. the rotation of the turret is a value (set by a laser on the turret) that is between 3.1416 and 6.2-ish. the laser on the radar has a rotation of 0.01 ish to 9 ish, but it is on the same scale as the laser on the turret! This is really confusing because both lasers turn in a complete circle, both can line up with the target (if the target is below the tank) but once above the tank, their values are different.


I'll link this to a save where you can see for yourself what is going on. the grey box in the scene shows 2 numbers, the first is the angle of the radar (stays 0 until the radar sees an enemy) and the second number is the angle of the turret.

some variables you might want to know:
scene.my.combatmodeT1 - stays 0 until tank sees enemy, then turns 1 (to activate targeting with the turret)
scene.my.angleT1 = the angle of the radar
scene.my.turretangleT1 = the angle of the turret

Scene: http://www.algodoo.com/algobox/details.php?id=82271

Scene tag:
Rating: rated 5
Filesize: 30.89 kB
Comments: 0
Ratings: 1
download
ddthj
 
Posts: 26
Joined: Sat Sep 11, 2010 11:41 pm

Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 6 guests