Suggestion: "Affected by Gravity" attribute for Actors

firemaplegamesfiremaplegames Member Posts: 3,211
edited November -1 in Working with GS (Mac)
Hey,

I think a really helpful addition to GS (for me anyway!) would be a Boolean Attribute for Actors called "Affected By Gravity".

This way you could easily have moving actors without having to always apply upward accelerations to them.
You could easily have moving platforms, or horizontal projectiles, or whatever - without all the extra rules just to keep them afloat.

If that's an easy enough thing to add in a future release, I would really love it.

In the meantime, can anybody help me with this situation?:

I have an invisible actor, that controls the camera. It moves across the scene at a diagonal. I am applying an upward acceleration equal to the Scene's gravity, but it still falls. That only seems to work for actors that don't change their X or Y positions.

If it only moved horizontally, I could use the standard constrain Y workaround, but it has to be able to move diagonally.

I just need it to move in a straight line, seemingly unaffected by gravity.

Any help is greatly appreciated.
Joe

Comments

  • EastboundEastbound Member, BASIC Posts: 1,074
    When you move it are you using the move to function or simply changing it's x and y values? I could imagine the latter wouldn't cause the upward acceleration.
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    You may need to add a timer to the changing of the XY so that it doesn't just jump to the corner you are moving to.

    Timer - Every .1 sec

    change self.position.X to self.position.X + 1
    and same for Y

    Play around with the time and the number you are adding
  • firemaplegamesfiremaplegames Member Posts: 3,211
    I am just using a Move To behavior. It doesn't jump instantly. I guess I could try a Timer and do it that way. It's not a perfect diagonal though, it's not x+1, y+1, it is different in every scene.

    So I'd have to use VectorToAngle on each iteration of the Timer, to set the X and Y. It just sounds processor intensive - although that could be the same exact way the Move To behavior works...
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    I still don't have a good sense of how the vector works, but it seems like you could adjust the slope of the movement by changing the x+1 to X+.8 or something. This should change the angle, right? Would that be less processor intensive than using vector? IDK
  • firemaplegamesfiremaplegames Member Posts: 3,211
    I'm not sure? but I don't want to calculate the slope of the line myself for each scene...

    This actor is a "preview" camera. It shows where the goal of the level is located, then pans back through the scene to the player.

    I just simply drag it out and place the actor on the "goal" of each level. It then moves back to the player automatically. But the goal can be below the player, or above him, or essentially way off in the distance somewhere.

    It behaves sort of OK, and it does work, I just wish I could counteract the gravity perfectly. I have several elements in the scene that rotate in place, and they behave fine - since they are not changing their linear velocity. I am able to keep them afloat with upwards acceleration.

    If they don't have to rotate/move, I can simply turn Movable off.

    It's just this one actor, who needs to move through the scene, that's misbehaving.
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    If you know the X and Y of the starting point and finish point you should be able to subtract and divide to figure out the slope. Y over X if I remember my "rise over run" from middle school days.
Sign In or Register to comment.