| 
 
 
 
	
	
		
			|   | Page 1 of 1 
 | [ 10 posts ] |  |   vel != change in position? 
        
        
            | Author | Message |  
			| Darlos9D 
					Joined: Mon Jul 16, 2007 9:50 am
 Posts: 1512
 Location: Tallahassee, FL
   |   vel != change in position?I've been trying to manually create a trail for a very fast projectile. If I just attach an emitter, it only releases emissions at the positions its at each frame, which are really far apart since it's going so fast. So what I'm doing is tracing ahead using the projectile's current velocity and creating a trail at several points along that vector, so the trail looks more continuous.
 The problem is, I've discovered that in CC the velocity of something doesn't measure how far it will travel in pixels in one frame. If you measure the change in position versus velocity, the change in position is a much smaller number, about 1/4 or 1/5. So does anybody know the proper conversion between an objects velocity and how far it actually means the object will go? I could just approximate it probably, but it'd be nice to know some exact numbers.
 
 
 |  
			| Sun Oct 25, 2009 3:23 am | 
					
					     |  
		|  |  
			| Duh102 happy carebear mom 
					Joined: Tue Mar 04, 2008 1:40 am
 Posts: 7096
 Location: b8bbd5
   |   Re: vel != change in position?I'm afraid I can't help you with a number, only a suggestion.You could potentially derive it experimentally with a projectile... Perhaps every frame output Δposition/velocity, then on destruction, the average of all of them? There is a "dump console to file" command, isn't there?
 
 
 |  
			| Sun Oct 25, 2009 3:33 am | 
					
					   |  
		|  |  
			| TheLastBanana DRL Developer 
					Joined: Wed Dec 13, 2006 5:27 am
 Posts: 3138
 Location: A little south and a lot west of Moscow
   |   Re: vel != change in position?I've found that generally, movement in pixels due to velocity is about 1/3 of the actual number.  So, for instance, if self.Vel is (3,3) and self.Pos is (0,0), next frame self.Pos will be (1,1). 
 
 |  
			| Sun Oct 25, 2009 3:42 am | 
					
					     |  
		|  |  
			| Darlos9D 
					Joined: Mon Jul 16, 2007 9:50 am
 Posts: 1512
 Location: Tallahassee, FL
   |   Re: vel != change in position?TheLastBanana wrote: I've found that generally, movement in pixels due to velocity is about 1/3 of the actual number.  So, for instance, if self.Vel is (3,3) and self.Pos is (0,0), next frame self.Pos will be (1,1).Yeah, this is what I've discovered as well. Good enough I guess.
 
 |  
			| Sun Oct 25, 2009 5:14 am | 
					
					     |  
		|  |  
			| Kyred 
					Joined: Sun May 31, 2009 1:04 am
 Posts: 308
   |   Re: vel != change in position?TheLastBanana wrote: I've found that generally, movement in pixels due to velocity is about 1/3 of the actual number.  So, for instance, if self.Vel is (3,3) and self.Pos is (0,0), next frame self.Pos will be (1,1).@TLB and Darlos Just out of curiosity, what are the DeltaTime's in your Settings.ini?
 
 |  
			| Sun Oct 25, 2009 10:55 am | 
					
					   |  
		|  |  
			| Sunrise 
					Joined: Thu Sep 03, 2009 4:21 pm
 Posts: 18
   |   Re: vel != change in position?Darlos9D wrote: TheLastBanana wrote: I've found that generally, movement in pixels due to velocity is about 1/3 of the actual number.  So, for instance, if self.Vel is (3,3) and self.Pos is (0,0), next frame self.Pos will be (1,1).Yeah, this is what I've discovered as well. Good enough I guess.I was working on similar thing just during last week. How about drawing the trail after the projectile? Store the position at the end of one cycle and draw trail from it to actual position in the begining of the new one? It worked fine for me:  By the way maybe you would find something useful here  or even give me some advice as more experienced Lua modders.
 
 |  
			| Sun Oct 25, 2009 11:23 am | 
					
					   |  
		|  |  
			| Abdul Alhazred DRL Developer 
					Joined: Tue Aug 11, 2009 5:09 am
 Posts: 395
   |   Re: vel != change in position?Darlos9D wrote: So does anybody know the proper conversion between an objects velocity and how far it actually means the object will go? I could just approximate it probably, but it'd be nice to know some exact numbers.This is what we know: Velocity is expressed in m/s. The time between updates are defined by delta time. The size of one meter is defined by PixelsPerMeter. I suspect it works like this: PixelsPerMeter*DeltaTime -> 20*0.0167=1/3. This would mean that the "movement factor" can be calculated like below to avoid problems with players using custom delta time.  Code: self.factor = FrameMan.PPM * TimerMan.DeltaTimeSecs
 
 |  
			| Sun Oct 25, 2009 4:30 pm | 
					
					   |  
		|  |  
			| Darlos9D 
					Joined: Mon Jul 16, 2007 9:50 am
 Posts: 1512
 Location: Tallahassee, FL
   |   Re: vel != change in position?Good to know! I will use this. 
 
 |  
			| Thu Oct 29, 2009 3:38 am | 
					
					     |  
		|  |  
			| Geti 
					Joined: Sun Jul 13, 2008 9:57 am
 Posts: 4886
 Location: some compy
   |   Re: vel != change in position?yeah, was going to mention pixelspermeter, but the fact that 1/3 works perfectly threw me off a bit. nice to know its an interaction with the deltatime. 
 
 |  
			| Thu Oct 29, 2009 4:35 am | 
					
					     |  
		|  |  
			| ProjektTHOR Banned 
					Joined: Tue Feb 27, 2007 4:05 pm
 Posts: 2527
   |   Re: vel != change in position?I love threads that talk about how bad Data is at modeling physics. 
 
 |  
			| Thu Oct 29, 2009 1:25 pm | 
					
					     |  
		|  |  
		|  |  
	
		
			|   | Page 1 of 1 
 | [ 10 posts ] |  |  
 
	
		| Who is online |  
		| Users browsing this forum: No registered users |  
 
	|  | You cannot post new topics in this forum You cannot reply to topics in this forum
 You cannot edit your posts in this forum
 You cannot delete your posts in this forum
 You cannot post attachments in this forum
 
 |  
   |