How to interact with an orbiting object?

alexlaptevalexlaptev Member Posts: 12
edited June 2012 in Working with GS (Mac)
Hi guys!

I am an absolute beginner in GameSalad, but I fell in love with it at first sight (as I am not a programmer, but a graphic designer).

I started doing one game, and immediately ran into a problem :) whose solution I can't find by myself, and I can't also find the thread that discuss it.

The task looks simple - The rocket rotates around the planet at a given speed. I want to add the following functionality: when a player pushes the rocket with his finger, it speeds up its rotation in a given direction, depending on the speed of finger slide (but not changes the rotation radius, even a bit). But after some time speed slows down to default.

I tried to customise the Tshirtbooth's tutorial for orbital rotation, tried the rotate behaviour with dynamic speed affected by linearvelocity, but nothing works the way I want it.

The community looks very friendly. Be easy, it is my first post. Thanks a lot in advance for any tips.

Cheers.

Answers

  • alexlaptevalexlaptev Member Posts: 12
    Thanks master, I made it!

    I used that principle with an axis, set the default angularvelocity to an axis (rocket follows it rotation), made a dummy object with a throw interaction, which is attached to the same position as rocket and rotates together with it. Than I made the following: when the dummy is touched, rotation of the axis is calculated as vectortoangle direction to dummy (and dummy is no more attached to rockets position); when dummy is thrown, angular velocity is calculated as abs(linearvelocityx)+abs(linearvelocityy) of the dummy (dummy is reattached to rocket after throwing). After I just made a rule that checks if angularvelocity is bigger or smaller than a defaut velocity and adjust it slowly to defailt.

    The only problem is that the rocket moves after throwing only one direction (positive "abs" velocities). I will really appreciates some tips how to solve that problem.
  • alexlaptevalexlaptev Member Posts: 12
    Just another question, stupid one: I want to create in the same scene different rockets (3, for example) that type. As I must to create 3 times all the set of global attributes and objects for each?
  • alexlaptevalexlaptev Member Posts: 12
    Here is the project files - will keep it there for a week: https://www.dropbox.com/s/xcsc71dqw4icjhu/rocket2.gameproj.zip
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    @alexlaptev -- You will get closer to the effect you want if you make the following changes.

    In the 'dummy' actor, get rid of the "abs()" stuff. It should be:
    Constrain Attribute: game.sunVelocity To: self.Motion.Linear Velocity.X+self.Motion.Linear Velocity.Y

    Then in the 'sun' actor, get rid of the last two rules and replace them with the following rule:
    When _ANY_
    -- game.sunVelocity > game.sunVelocityLimit
    -- game.sunVelocity < -game.sunVelocityLimit
    ---- Constrain Attribute: game.sunVelocity To: game.sunVelocity *.99
  • alexlaptevalexlaptev Member Posts: 12
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    @alexlaptev -- The solution I gave really does make it do what you asked! (But your other thread is interesting too.) Just do the two changes I suggested and it will orbit correctly, and it will slow down correctly.

    There are several things you can do to simplify the setup. (But perhaps that's what you are after in your other thread.)
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    @alexlaptev -- I've been thinking about this a little more. Does the this get closer to what you want?
    http://www.mediafire.com/download.php?1u4yb0vskfd9rvx
  • alexlaptevalexlaptev Member Posts: 12
    Your solution is very elegant... It is so simple. The way to use timer as a keyframer, I think, will never come to my mind by itself :) Thanks a lot for your care and ideas. Please check my solution - what you think about it? There are some fancy actions. Please remember, that I am really not a programmer. https://www.dropbox.com/s/jw8afl6ufu7ufb4/fancyrocket.zip
Sign In or Register to comment.