Have a platform rotate but not move when ball hits it

MammothMammoth Member Posts: 640
edited November -1 in Working with GS (Mac)
So I have been trying to have a ball hit a platform. What I want to happen is when I touch the platform I want it to rotate. Naturally if the ball hits it the physics moves the platform. However if I deselect movable I can't move the platform.

I have tried constraining the self.position.x to self.position.x in an attribute but that doesn't work.

I have tried putting the density of the platform really high but when there are a lot of balls on the screen the platforms still move.

Has anybody had this problem before. I have done a google search on this and I couldn't seem to find the answer.

Any help is appreciated :)

Comments

  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    hey there you have a couple options. The quickest and easiest is deselect moveable and then instead of using a rotate behavior use this rule.

    When attribute self.rotation equals 0
    --interpolate self.rotation to 360

    That will make it rotate without physics so the biggest issue you may run into is your balls may not bounce properly off of it. I think it will work fine though as long as you have a decent restitution setup in your ball.

    If you want it to rotate in the opposite direction use -360 in place of 360. and your speed will be determined by the duration you set for the interpolate.

    hope that helps.

    Aaron

    ___________________________________________________________________________________
    GS BubbleBall Template HERE!!
    Stacks Level Selection Template HERE!!
    Expanding Option Menu Template HERE!!
    Tenrdrmer's Menu # 3 HERE!!
    AppSolute Entertainment on Facebook
    AppSolute Entertainment on iTunes
  • ChaserChaser Member Posts: 1,453
    Have you tried like 40,000 plus density on the platform and 0 density on the ball
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Chaser said:
    Have you tried like 40,000 plus density on the platform and 0 density on the ball

    I think you will still get unreliable performance. interpolate is going to be the least resource expensive method. If your not happy with the non-moveable route you simple need to add a couple self attributes start.x and start.y

    at the top of your rules place Change Attribute Self.Start.x to self.position.x and self.start.y to self.position.y

    then constrain self.position.x to self.start.x and self.position.y to self.start.y

    it will be a little harder on performance but you will be able to use physics on your platform also if its needed.
  • MammothMammoth Member Posts: 640
    Perfect that worked!

    Thanks guys :)
Sign In or Register to comment.