Help needed with moving ball

Hi there, I am currently working with the elasticity demo that I have altered. I would like to have it so when you stretch the actor back and release it, it collides with the ball and the ball bounces around like a air hockey puck. All that happens currently when the actor hits the ball, the ball barely moves at all. I have attached the project file, please help if you can. Thanks!

Best Answers

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

    Yeah ! :p

    Constrain self.Motion.linear.velocity X to 282.8*cos(vectorToAngle( self.Position.X - game.ballX , self.Position.Y - game.ballY ))

    Constrain self.Motion.linear.velocity Y to 282.8*sin(vectorToAngle( self.Position.X - game.ballX , self.Position.Y - game.ballY ))

    . . . . same deal for the rest of the balls, but obviously changing the 'game.ballX' attribute to the relevant attribute (game.ballX2, game.ballX3 . . . etc)

    Actually it might make more sense in the actual project, hold on . . . back in a second . . . . . .

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

Answers

Sign In or Register to comment.