|  | 
| 
 
 
 
 
 
 
 
 
    
    
 |  | 
 
 
	
		|  |  |  
	
	
		
	
	
	| 
			
			 
			
				August 16th, 2007, 07:10 PM
			
			
			
		 |  
	| 
		
			|  | 
 Shrapnel Fanatic |  | 
					Join Date: Mar 2003 Location: CHEESE! 
						Posts: 10,009
					 Thanks: 0 
		
			
				Thanked 7 Times in 1 Post
			
		
	      |  |  
    
	| 
				 OT: Looking for a good physics site 
 I'm trying to code intercept calculations for two spaceships, both capable of velocity, acceleration and different positions.
 I don't want hints. I have been working on this code off and on for months. I don't care about figuring it out myself. I just want to know how to code it.
 
 Many explicitives were deleted in the making of this post.
 
				__________________ 
				If I only could remember half the things I'd forgot, that would be a lot of stuff, I think - I don't know; I forgot!  
A* E* Se! Gd! $-- C-^- Ai** M-- S? Ss---- RA Pw? Fq Bb++@ Tcp? L++++ 
Some of my webcomics.  I've got 400+ webcomics at Last count, some dead. 
Sig updated to remove non-working links.
			 |  
	
		
	
	
	| 
			
			 
			
				August 16th, 2007, 08:00 PM
			
			
			
		 |  
	| 
		
			|  | Shrapnel Fanatic |  | 
					Join Date: Feb 2001 Location: Waterloo, Ontario, Canada 
						Posts: 11,451
					 Thanks: 1 
		
			
				Thanked 4 Times in 4 Posts
			
		
	      |  |  
    
	| 
				 Re: OT: Looking for a good physics site 
 Is the target ship going to have a constant acceleration, or will it actively evade? 
				__________________ 
				Things you want: |  
	
		
	
	
	| 
			
			 
			
				August 16th, 2007, 08:52 PM
			
			
			
		 |  
	| 
		
			|  | 
 Shrapnel Fanatic |  | 
					Join Date: Mar 2003 Location: CHEESE! 
						Posts: 10,009
					 Thanks: 0 
		
			
				Thanked 7 Times in 1 Post
			
		
	      |  |  
    
	| 
				 Re: OT: Looking for a good physics site 
 I'm just looking for straight-line acceleration right now. More complex stuff can wait.
 Thanks for any and all help.
 
				__________________ 
				If I only could remember half the things I'd forgot, that would be a lot of stuff, I think - I don't know; I forgot!  
A* E* Se! Gd! $-- C-^- Ai** M-- S? Ss---- RA Pw? Fq Bb++@ Tcp? L++++ 
Some of my webcomics.  I've got 400+ webcomics at Last count, some dead. 
Sig updated to remove non-working links.
			 |  
	
		
	
	
	| 
			
			 
			
				August 16th, 2007, 09:12 PM
			
			
			
		 |  
	| 
		
			|  | 
 Shrapnel Fanatic |  | 
					Join Date: Mar 2003 Location: CHEESE! 
						Posts: 10,009
					 Thanks: 0 
		
			
				Thanked 7 Times in 1 Post
			
		
	      |  |  
    
	| 
				 Re: OT: Looking for a good physics site 
 Also, I just want the enemy ship to hit the target ship - Missile interception. I can probably manage to work out how to match velocities from that. 
				__________________ 
				If I only could remember half the things I'd forgot, that would be a lot of stuff, I think - I don't know; I forgot!  
A* E* Se! Gd! $-- C-^- Ai** M-- S? Ss---- RA Pw? Fq Bb++@ Tcp? L++++ 
Some of my webcomics.  I've got 400+ webcomics at Last count, some dead. 
Sig updated to remove non-working links.
			 |  
	
		
	
	
	| 
			
			 
			
				August 16th, 2007, 10:11 PM
			
			
			
		 |  
	| 
		
			|  | Shrapnel Fanatic |  | 
					Join Date: Feb 2001 Location: Waterloo, Ontario, Canada 
						Posts: 11,451
					 Thanks: 1 
		
			
				Thanked 4 Times in 4 Posts
			
		
	      |  |  
    
	| 
				 Re: OT: Looking for a good physics site 
 Wasn't that where you were having all the problems before?Reversing thrust at half way causing all kinds of grief?
 
				__________________ 
				Things you want: |  
	
		
	
	
	| 
			
			 
			
				August 16th, 2007, 10:26 PM
			
			
			
		 |  
	| 
		
			|  | 
 Shrapnel Fanatic |  | 
					Join Date: Mar 2003 Location: CHEESE! 
						Posts: 10,009
					 Thanks: 0 
		
			
				Thanked 7 Times in 1 Post
			
		
	      |  |  
    
	| 
				 Re: OT: Looking for a good physics site 
 I've gone through a number of calculations. None of them worked completely. The closest I got was an angle calculation that works for velocity only.
 I have never gotten any kind of interception that works perfectly for velocity, acceleration and position, either missile interception or matching interception.
 
 And by 'perfectly', I mean, 'Intercepts, in a straight line, a target moving in a straight line'.
 
				__________________ 
				If I only could remember half the things I'd forgot, that would be a lot of stuff, I think - I don't know; I forgot!  
A* E* Se! Gd! $-- C-^- Ai** M-- S? Ss---- RA Pw? Fq Bb++@ Tcp? L++++ 
Some of my webcomics.  I've got 400+ webcomics at Last count, some dead. 
Sig updated to remove non-working links.
			 |  
	
		
	
	
	| 
			
			 
			
				August 16th, 2007, 11:11 PM
			
			
			
		 |  
	| 
		
			|  | 
 Major |  | 
					Join Date: Apr 2004 Location: Atlanta, Georgia 
						Posts: 1,152
					 Thanks: 0 
		
			
				Thanked 0 Times in 0 Posts
			
		
	      |  |  
    
	| 
				 Re: OT: Looking for a good physics site 
 I'll see if I can work out the math for a least-time position only intercept, assuming the target has constant acceleration and the only variable is what direction the missile accelerates in. |  
	
		
	
	
	| 
			
			 
			
				August 16th, 2007, 11:15 PM
			
			
			
		 |  
	| 
		
			|  | 
 Shrapnel Fanatic |  | 
					Join Date: Mar 2003 Location: CHEESE! 
						Posts: 10,009
					 Thanks: 0 
		
			
				Thanked 7 Times in 1 Post
			
		
	      |  |  
    
	| 
				 Re: OT: Looking for a good physics site 
 Well, they also start at different positions.
 Thanks, wether you manage it or not.
 
				__________________ 
				If I only could remember half the things I'd forgot, that would be a lot of stuff, I think - I don't know; I forgot!  
A* E* Se! Gd! $-- C-^- Ai** M-- S? Ss---- RA Pw? Fq Bb++@ Tcp? L++++ 
Some of my webcomics.  I've got 400+ webcomics at Last count, some dead. 
Sig updated to remove non-working links.
			 |  
	
		
	
	
	| 
			
			 
			
				August 17th, 2007, 05:04 PM
			
			
			
		 |  
	| 
		
			|  | 
 Second Lieutenant |  | 
					Join Date: Mar 2005 Location: Seattle, WA 
						Posts: 417
					 Thanks: 0 
		
			
				Thanked 0 Times in 0 Posts
			
		
	      |  |  
    
	| 
				 Re: OT: Looking for a good physics site 
 
	Quote: 
	
		| narf poit chez BOOM said: I'm trying to code intercept calculations for two spaceships, both capable of velocity, acceleration and different positions.
 
 |  The problem is in framing the question. So let me ask you about what you are trying to achieve: Does a dog chase a cat by predicting where the cat will be next frame? Does a Cheetah hunt a deer by moving towards a calculated destination? The answer of course is no.
 
What we are trying to implement here can be described by fighter pilots: The three modes of persuit are Pure Persuit, Lag Persuit, and Lead Persuit. Pure Persuit  is probably most familiar. It involves pointing your nose directly at the target. Heat seaker missiles follow this course. Unfortunately, so do a lot of weak AI opponants. It is also fairly easy to outmaneuver; just turn so that the enemy is sleightly behind you and you will arc around him.Lag Persuit  is what a dog does to a person. He points his nose behind the target, and this changes the way his target is facing fastest. It brings him around to the rear of his opponant.Lead Persuit  is what is what is meant by an "intercept course", and involves pointing your nose in front of your opponant. It's what children playing a game of tag do.
 
On to an intercept algorithm. Instead of percieving the universe as a set of coordinates from "above", consider a 'ground-level' view. What you can do is turn to place him at any angle from you. You could turn to put him in your 12:00--dead ahead. What you can watch is what angle he is presenting to you. If you are in his 6:00 he is running straight away from you.
 
Let's start by saying you are both the same speed. We'll add speed difference in a moment. If he is facing directly at you, or directly away from you, then you should turn to face directly at him. What if he is facing so that you are in his 9:00 or 3:00 -- directly abreast of his run? Then you will have to run in the same direction on a parallel course until something changes. Do that by turning to put him in your 3:00/9:00.
 
So now we have straight-on, and parallel-course; 0~90 degrees, based on his presentation of 0~90 degrees. these are the two extremes, and the only thing left is to figure out what the middle values should be. It's easy enough for dumb animals, so we should be able to 'get it'. As the target turns more and more away from dead-on, so should you. Atan2 of his angle gives the fraction.
 
Now about that speed difference. If you are moving twice as fast as the target, then cut the angle change in half. Pretty cool, huh?
			
			
			
			
				  |  
	
		
	
	
	| 
			
			 
			
				August 17th, 2007, 05:17 PM
			
			
			
		 |  
	| 
		
			|  | 
 Shrapnel Fanatic |  | 
					Join Date: Mar 2003 Location: CHEESE! 
						Posts: 10,009
					 Thanks: 0 
		
			
				Thanked 7 Times in 1 Post
			
		
	      |  |  
    
	| 
				 Re: OT: Looking for a good physics site 
 You just gave me a formula I already tried. It worked for velocity.
 Also, you probably didn't mean to, but your post comes across as condescending.
 
				__________________ 
				If I only could remember half the things I'd forgot, that would be a lot of stuff, I think - I don't know; I forgot!  
A* E* Se! Gd! $-- C-^- Ai** M-- S? Ss---- RA Pw? Fq Bb++@ Tcp? L++++ 
Some of my webcomics.  I've got 400+ webcomics at Last count, some dead. 
Sig updated to remove non-working links.
			 |  
	
		
	
	
	
	
	
	
	| 
	|  Posting Rules |  
	| 
		
		You may not post new threads You may not post replies You may not post attachments You may not edit your posts 
 HTML code is On 
 |  |  |  |  |