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
-
Socks London, UK.Posts: 12,822
Yeah !
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 . . . . . .
Answers
Awesome! Thanks Socks
Perfect! Thank you!