Page 1 of 1

observer:goto - accelTime seems to cause a display jump

Posted: 23.02.2005, 05:59
by cpotting
Hi everyone.

I was experimenting with the parameters in the celx goto method for observers and saw something strange. I am wondering if it is just my machine or is this endemic to Celestia.

The code below shows two views of the same journey from Earth to Procyon and worked well enough for me to determine what the accelTime parameter does. However, if I set accelTime to any value close to .1 I see the observer jump to the final location once the journey is 50% complete. Even though position information indicates that the observer has not yet reached the final destination, the view will show the observers as being there.

I saw that code does not allow values below .1 for accellTime, but I don't see any reason why it should behave this way for values of .1 and slightly above.

Code: Select all

EARTH = celestia:find("EARTH")
THERE = celestia:find("PROCYON")
THEREPOS = THERE:getposition() + celestia:newposition(1,1,1)

celestia:getobserver():singleview()
celestia:getobserver():track(nil)
celestia:getobserver():goto(EARTH,5);wait(6)
celestia:getobserver():track(THERE)
celestia:getobserver():splitview("v")
obsvrs = celestia:getobservers()

--accelTime, duration, endInterpolation, finalOrientation, from, initialOrientation, startInterpolation, to

journey_A = { duration = 100, from=EARTH:getposition(), to=THEREPOS, accelTime=.2 }
journey_B = { duration = 100, from=EARTH:getposition(), to=THEREPOS, accelTime=.8}
celestia:flash("starting journeys")
starttime = celestia:getscripttime()
lasttime = starttime
last_A = obsvrs[1]:getposition()
last_B = obsvrs[2]:getposition()
obsvrs[1]:goto(journey_A)
obsvrs[2]:goto(journey_B)
while obsvrs[1]:travelling() or obsvrs[2]:travelling() do
   now = celestia:getscripttime()
   pos_A = obsvrs[1]:getposition()
   pos_B = obsvrs[2]:getposition()
   speed_A = pos_A:distanceto(last_A) / (now - lasttime)
   speed_B = pos_B:distanceto(last_B) / (now - lasttime)
   lasttime = now
   last_A = pos_A
   last_B = pos_B
   celestia:flash(math.floor(now - starttime).."\nA v:"..math.floor(speed_A).."\nB v:"..math.floor(speed_B))
   wait(.001)
end
celestia:flash("journeys complete")


Can anyone else see this happen or is it just me.