View unanswered posts | View active topics It is currently Fri Dec 27, 2024 8:19 am



Reply to topic  [ 10 posts ] 
 vel != change in position? 
Author Message
User avatar

Joined: Mon Jul 16, 2007 9:50 am
Posts: 1512
Location: Tallahassee, FL
Reply with quote
Post 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
Profile YIM
happy carebear mom
User avatar

Joined: Tue Mar 04, 2008 1:40 am
Posts: 7096
Location: b8bbd5
Reply with quote
Post 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
Profile
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3138
Location: A little south and a lot west of Moscow
Reply with quote
Post 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
Profile WWW
User avatar

Joined: Mon Jul 16, 2007 9:50 am
Posts: 1512
Location: Tallahassee, FL
Reply with quote
Post 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
Profile YIM
User avatar

Joined: Sun May 31, 2009 1:04 am
Posts: 308
Reply with quote
Post 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
Profile

Joined: Thu Sep 03, 2009 4:21 pm
Posts: 18
Reply with quote
Post 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.


Sun Oct 25, 2009 11:23 am
Profile
DRL Developer
DRL Developer

Joined: Tue Aug 11, 2009 5:09 am
Posts: 395
Reply with quote
Post 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
Profile
User avatar

Joined: Mon Jul 16, 2007 9:50 am
Posts: 1512
Location: Tallahassee, FL
Reply with quote
Post Re: vel != change in position?
Good to know! I will use this.


Thu Oct 29, 2009 3:38 am
Profile YIM
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post 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
Profile WWW
Banned
User avatar

Joined: Tue Feb 27, 2007 4:05 pm
Posts: 2527
Reply with quote
Post 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
Profile YIM
Display posts from previous:  Sort by  
Reply to topic   [ 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

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.128s | 13 Queries | GZIP : Off ]