Data Realms Fan Forums
http://forums.datarealms.com/

vel != change in position?
http://forums.datarealms.com/viewtopic.php?f=73&t=16947
Page 1 of 1

Author:  Darlos9D [ Sun Oct 25, 2009 3:23 am ]
Post subject:  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.

Author:  Duh102 [ Sun Oct 25, 2009 3:33 am ]
Post subject:  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?

Author:  TheLastBanana [ Sun Oct 25, 2009 3:42 am ]
Post subject:  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).

Author:  Darlos9D [ Sun Oct 25, 2009 5:14 am ]
Post subject:  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.

Author:  Kyred [ Sun Oct 25, 2009 10:55 am ]
Post subject:  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?

Author:  Sunrise [ Sun Oct 25, 2009 11:23 am ]
Post subject:  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:
Image

By the way maybe you would find something useful here or even give me some advice as more experienced Lua modders.

Author:  Abdul Alhazred [ Sun Oct 25, 2009 4:30 pm ]
Post subject:  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

Author:  Darlos9D [ Thu Oct 29, 2009 3:38 am ]
Post subject:  Re: vel != change in position?

Good to know! I will use this.

Author:  Geti [ Thu Oct 29, 2009 4:35 am ]
Post subject:  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.

Author:  ProjektTHOR [ Thu Oct 29, 2009 1:25 pm ]
Post subject:  Re: vel != change in position?

I love threads that talk about how bad Data is at modeling physics.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/