actor freaking out on trampoline

matthewsuttlesmatthewsuttles Member Posts: 42
edited May 2012 in Working with GS (Mac)
Hey everyone,
I am now having an issure when my actor bounces on my trampoline. When it gets close to the end of the scene (probably within 150px from the end), the actor hits the tramp it shoots it super fast to the right when it should just bounce somewhat straight up.

my scene is 700 px wide

Here is my code

when actor hits trampoline

change attribute
self.motion.linear velocity x to self.motion.linear velocity x+4*(self.position.X - game.mouse.position.x)

Answers

  • ZoytZoyt Member Posts: 374
    Why don't you accelerate it 90 degrees up very fast. Make sure it's angled I'm relevance to the scene. Hope that helps!
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    Here's what I would try. Just set the restitution on the tramp to 1.2 or so and 1 on the bouncing actor. Then of course the constrain to mouse will screw it up. But wait! There is a solution to that!

    DONT CONSTRAIN TO THE MOUSE POSITION

    Do this instead:

    In the trampoline

    constrain self.linear.velocity.X to (Mouse.position.X-self.position.X)*30

    change the 30 to a higher number to make it more responsive and a lower number to make it less responsive.

    With this method you will get natural physics!

    I think this will give you more natural physics than messing around with a bunch of math (boooo!)
  • matthewsuttlesmatthewsuttles Member Posts: 42
    @scitunes
    thanks sci tunes I will give this a try.
Sign In or Register to comment.