How do I make an actor float.

iDeveloperziDeveloperz Member Posts: 1,169
edited November -1 in Working with GS (Mac)
Sorry for being a bit vague but how would I make say a button float so it is always moving in the same spot.

Like a fish in a water.

Comments

  • AfterBurnettAfterBurnett Member Posts: 3,474
    I saw something in the wiki about this... can't remember where but it's there... moving in a wave motion... could tweak that a bit ;)
  • iDeveloperziDeveloperz Member Posts: 1,169
    Thanks man Ill have a look now.

    Is it a tutorial or a how to?
  • iDeveloperziDeveloperz Member Posts: 1,169
    Nah I can't seem to find it.

    Has anybody else here done this before?
  • POMPOM Member Posts: 2,599
    to make an actor float you can do:

    constrain attribute : self X to sin( self.Time * "speed" ) * pixels to move + starting positionX

    speed - any integer
    pixels to move - any integer - for example if you put 30 the actor will go 30 to the right and 30 to the left , so the total movement will be 60 pixels wide.
    starting positionX - the initial X value of the actor in the scene (do not use self.x)

    this will make the actor to move left and right !

    if you want to add a little up and down to imitate float do this for the Y :

    constrain self.Y to sin( self.Position.X * speed)*pixels to move+ starting position Y

    here instead of using self.time we use self.x because self.time will make the actor go in an angle .
    i suggest to put a small number in speed here to make a float

    hope it helps
  • iDeveloperziDeveloperz Member Posts: 1,169
    Thank you very much p-o-m it worked!

    :D
Sign In or Register to comment.