start of rotation

Hi there,
I was just wondering if any of you mathematicians could help me. In my game when the gal collides with an actor, it rotates around the actor. The problem is is that it doesn't start rotating from the point of collision. This is the rotating equation I am using: constrain x to 58*cos( self.Time *-200%360)+ game.p1 x.
Can anyone help me have it rotate around the actor from the collision point?
Thanks

Best Answers

  • SocksSocks London, UK.Posts: 12,822
    edited June 2014 Accepted Answer

    @GamesforGood said:
    Hi there,
    I was just wondering if any of you mathematicians could help me. In my game when the gal collides with an actor, it rotates around the actor. The problem is is that it doesn't start rotating from the point of collision. This is the rotating equation I am using: constrain x to 58*cos( self.Time *-200%360)+ game.p1 x.
    Can anyone help me have it rotate around the actor from the collision point?
    Thanks

    Firstly, there is no need for the %360 bit . . . . as for starting the collision at the point of impact just add in the angle of collision (AOC) here . . .

        Constrain x to 58*cos((self.Time *-200)+AOC)+ game.p1 x
        Constrain y to 58*sin((self.Time *-200)+AOC)+ game.p1 y
    

    The angle of collision can be calculated with vector to angle.

    P.S. instead of using -200 to make the rotation clockwise, you can also just swap sin and cos . . . .

        Constrain x to 58*sin((self.Time *200)+AOC)+ game.p1 x
        Constrain y to 58*cos((self.Time *200)+AOC)+ game.p1 y
    
  • SocksSocks London, UK.Posts: 12,822
    Accepted Answer

    Demo:

    https://www.mediafire.com/?tue5m94ub886791

    Click on the screen to generate a 'gal' (I don't know what a gal is !!).

Answers

  • GamesforGoodGamesforGood Member Posts: 73

    Once again my mind is blown by your mathematics. Just wait until I release my mad geometry skills though...

  • SocksSocks London, UK.Member Posts: 12,822

    @GamesforGood said:
    Once again my mind is blown by your mathematics.

    It's pretty basic stuff you could learn in an hour.

Sign In or Register to comment.