Artillery

Discuss scenes and videos made with Algodoo.

Artillery

Postby Ivanlul » Sun Nov 08, 2009 10:03 pm

Rating: rated 6.9
Filesize: 35.16 kB
Comments: 7
Ratings: 6
download


I was reading A farewell to arms and the main character got shelled by artillery. That gave me the idea to make a cannon that can track a tracker.

ETA - how long it will take for the shells to get there.
Distance - The distance away from the cannon, max is 3000 meters/1.86 miles.
Angle - Whether the angle is low or high.

Controls:
Enter - fire.
1 - Switch between low and high angle.
Arrow keys - control test car.

Notes:
Position tracker is the red thing on the test car. It can be detached and moved by different methods (airplane, rocket, etc).

To look at the actual cannon zoom out all the way, you will see a big red box. Follow that box all the way back and below it you will see the cannon.

It's accuracy is within is between .5 - 15 meters, depending on the distance.

If you import the cannon and tracker into a different scene declare these variables:
scene.my.pos1 = [0,0]
scene.my.pos2 = [0,0]
scene.my.angle1 = 0
scene.my.typeangle = 0
scene.my.typeangle1 = "zero"
scene.my.time = 0


Technical_info wrote:Computer:
Image
Image
onHitByLaser = (e)=>{
{scene.my.typeangle == 1} ? {scene.my.angle1 = (math.Atan((30625 + (937890625 - 96.04 * scene.my.pos2(0) * scene.my.pos2(0) - 600250 * scene.my.pos2(1)) ^ 0.5) / (9.8 * scene.my.pos2(0))))} : {scene.my.angle1 = (math.Atan((30625 - (937890625 - 96.04 * scene.my.pos2(0) * scene.my.pos2(0) - 600250 * scene.my.pos2(1)) ^ 0.5) / (9.8 * scene.my.pos2(0))))};
scene.my.pos1 = e.pos;
scene.my.time = (scene.my.pos2(0)) / (175 * math.cos(scene.my.angle1))

};

Cannon:
onHitByLaser = (e)=>{
{{controllerAcc + 0.5} < sim.time} ? {
Scene.addcircle({
pos := e.pos;
buttonDestroy = "l";
attraction := 0;
vel := ([math.cos(scene.my.angle1), math.sin(scene.my.angle1)]) * 175;
radius := 0.25;
collideset := 1;
drawcake := true;
heteroCollide := true;
drawborder := false;
color := [0, 0, 0, 1];
density := 100;
friction := 0.0;
restitution := 0.5
});

Tracker:
onHitByLaser = (e)=>{scene.my.pos2 = e.pos - scene.my.pos1};
Registered: 2008-10-16
Image
User avatar
Ivanlul
 
Posts: 763
Joined: Mon Aug 31, 2009 11:19 pm
Location: US

Re: Artillery

Postby cdh473 » Thu Nov 12, 2009 2:39 am

That looks quite complicated. Good work.
Please excuse my posts. I am extremely stupid.
User avatar
cdh473
 
Posts: 817
Joined: Tue Sep 01, 2009 12:37 am
Location: Yes

Re: Artillery

Postby Ivanlul » Thu Nov 12, 2009 2:53 am

Thanks!
User avatar
Ivanlul
 
Posts: 763
Joined: Mon Aug 31, 2009 11:19 pm
Location: US


Return to Scenes

Who is online

Users browsing this forum: No registered users and 3 guests