Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → MoveToFrame - with rotation [Cross post from Hub]
MoveToFrame - with rotation [Cross post from Hub]
2005-11-15, 6:20 AM #1
[Originally posted on the Hub: http://www.jkhub.net/forums/viewtopic.php?t=349 ]

When I try to use MoveToFrame() to move an object between two frames that also has a rotation, the thing moves between the two frames and THEN rotates when it gets there.

Is anyone aware of why this effect occurs and anything I might be able to do to avoid the problem?
2005-11-15, 12:20 PM #2
I think there is a cog command to rotate objects. I'm too lazy to verify, but if it's true, you should make the frames without rotation, then apply the rotation with said command.
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2005-11-15, 2:25 PM #3
Post your code.
And when the moment is right, I'm gonna fly a kite.
2005-11-15, 5:16 PM #4
goRotate(); I think
2005-11-16, 12:28 AM #5
cog:
Code:
# Jedi Knight Cog Script
# 
# Asteroid Controller
# 
# Sets up the asteroids to float across space
# 
# Giraffe
# 28/10/2005
# ======================

symbols

  thing		ghostthing
  template	asteroidtemplate
  thing		asteroidthing		local

  int		wormholeexitframe
  int		wormholeentryframe
  int		wormholewarpsourceframe
  int		wormholewarpdestframe

  flex		wormholespeed
  flex		normalspacespeed

  int		state			local

  message	startup
  message	arrived

end

code

  startup:
    state = 0;
    asteroidthing = CreateThing(asteroidtemplate, ghostthing);
    AttachThingToThing(asteroidthing, ghostthing);
    MoveToFrame(ghostthing, wormholeexitframe, wormholespeed);
  return;

  arrived:
    if (state == 0)
    {
      state = 1;
      MoveToFrame(ghostthing, wormholeentryframe, normalspacespeed);
    }
    else if (state == 1)
    {
      state = 2;
      MoveToFrame(ghostthing, wormholewarpsourceframe, wormholespeed);
    }
    else if (state == 2)
    {
      state = 3;
      DestroyThing(asteroidthing);
      MoveToFrame(ghostthing, wormholewarpdestframe, 100);
    }
    else if (state == 3)
    {
      state = 0;
      asteroidthing = CreateThing(asteroidtemplate, ghostthing);
      AttachThingToThing(asteroidthing, ghostthing);
      MoveToFrame(ghostthing, wormholeexitframe, wormholespeed);
    }
  return;
end


The Create/Attach/Destroy code is there so that I can move the object straight back to the warpdestframe without it going through all the intervening frames. I tried using a combination of SkipToFrame and JumpToFrame, but that doesn't update the frame the object is actually on, so when it then moves to the next frame, it first off all moves to the frame next to the warpsourceframe and then all the intervening frames back to the first frame, and THEN movese to the frame it's heading for.

The .jed file has the following properties on the ghosthing object:
Code:
 THINGFLAGS=0x400048
 NUMFRAMES=10
 FRAME=(5/1/0:0/0/0)
 FRAME=(2.75/2/0:0/337.38/0)
 FRAME=(1.934/2.491/0:0/320.535/-10)
 FRAME=(1.296/3.197/0:0/303.069/-20)
 FRAME=(.889/4.058/0:0/286.845/-30)
 FRAME=(.75/5/0:0/270/-40)
 FRAME=(.889/5.942/0:0/253.155/-50)
 FRAME=(1.296/6.803/0:0/236.31/-60)
 FRAME=(1.934/7.509/0:0/219.465/-70)
 FRAME=(2.75/8/0:0/202.62/-80)


The template being used is:
Code:
# DESC: 
# BBOX: -.7 -.72 -.53 .79 .63 .37
ast_01            _walkstruct        size=1.00396 movesize=1.00396 model3d=ast01.3DO

↑ Up to the top!