How can i make a ball bounce on only actors i want it only to bounce on?

DarkUndeadSpawnDarkUndeadSpawn Member Posts: 64
edited July 2012 in Working with GS (PC)
Hello,

Well i been wanting to ask a question about this for a long time now.

I been having trouble with..

I have tried to make this ball bounce off only sertain surfaces but it either rolls to the left but does nothing but just shake..

I need a great solution on how i may make the ball bounce on only the actors i would want and to End game when it hits a actor i dont want it to hit..

The ball is going into a 45 degree angle with the speed of 200.. the gravity on y is 200.0000..
Rule:
Conditions:
Actor overlaps or collides with: actor of type/ Walls
Actor overlaps or collides with: Actor of type/ Pillar

Do:
Set: Self.randRotate
To: random(0,1)
Tell me if i did something wrong?
New Rule:
if self.randrotate = 1

Do:
Constrain Attribrute:
Constrain: angularVelocity (I was told to put this in the constrain path but it comes up as a invalid path.)
To: ( ( abs( (self.LinearVelocity.X) )+abs( (self.LinearVelocity.Y) ) )/2 )
I need to know so i can fix this problem.
New Rule:
if self.randrotate = 0

Do:
Constrain Attribrute:
Constrain: angularVelocity (I was told to put this in the constrain path but it comes up as a invalid path.)
To: ( ( abs( (self.LinearVelocity.X) )+abs( (self.LinearVelocity.Y) ) )/2 )*(-1)
Thankyou and have a nice day.

Sincerly,
DarkUndeadSpawn

Best Answers

  • LumpAppsLumpApps Posts: 2,881
    edited July 2012 Accepted Answer
    Start by giving gravityY a lower value. Like 1000. How did you come up with 200.000? That is way to much.
    As for the rule and new rule: what exactly are you trying to accomplish?
    There is a collision behaviour you can use to let the ball bounce of objects. And for having the game end only when the ball hits actors of a certain type that can be set up with a collision rule.
    Rule:
    Collides with actor of type... Etc.

    Hope this helps a bit.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Posts: 9,922
    Accepted Answer
    You need to use a change attribute and not a constrain as once you constrain it ..it overrides collisions just like a mouse constrain. Not sure what else you mean about the angle as you were not clear and you are not showing the code of how you're firing the ball and how it's getting it's initial vector for travel direction.
  • NmdogdudeNmdogdude Posts: 174
    Accepted Answer
    Try giving your actors tags bounce/no bounce. In the ball's rule when actor collides w/ actor of tage bounce, (collide behavior )... Otherwise, change self.linearvelocity.y. to 0. You should probably lower the gravity. If you have both the acceleration and gravity set the same the ball will go in a straight line ( a lower gravity will make an arc bounce.)
  • The_Gamesalad_GuruThe_Gamesalad_Guru Posts: 9,922
    Accepted Answer
    In your move behavior change it to relative to scene not actor.

Answers

  • DarkUndeadSpawnDarkUndeadSpawn Member Posts: 64
    Start by giving gravityY a lower value. Like 1000. How did you con up with 200.000? That is way to much.
    As for the rule and new rule: what exactly are you trying to accomplish?
    There is a collision behaviour you can use to let the ball bounce of objects. And for having the game end only when the ball hits actors of a certain type that can be set up with a collision rule.
    Rule:
    Collides with actor of type... Etc.

    Hope this helps a bit.

    Are you by any chance new?

    Cause its just 200 im saying it like 200.0000 as in the values 1000.0000 is very high..

    And i have said before that i have done that but i am making a launcher game where you press a button and it launches a ball and its going in 45 degree angle and all im asking is how come its going in one angle since i added a move persistent its not bouncing off anything only one angle..

    Its very difficult to figure what i shall do..

    Not to many tutorials on how to do so..

    Thankyou and have a nice day

    Sincerly,
    DarkUndeadSpawn
  • DarkUndeadSpawnDarkUndeadSpawn Member Posts: 64
    You need to use a change attribute and not a constrain as once you constrain it ..it overrides collisions just like a mouse constrain. Not sure what else you mean about the angle as you were not clear and you are not showing the code of how you're firing the ball and how it's getting it's initial vector for travel direction.
    No code im just using..

    Touch.Pressed
    Spawn Actor
    Director 137.121096396661

    I was told to use those to make em bounce but i just deleted the rule values..

    Im also using a move value for my Ball and collide..

    Well it might the part where its the direction it is moving in and when its only moving in that direction it has no were else but one way..
    Photobucket

    I wonder how i can fix this problem..
    Photobucket

    I need a solution please i hope this was more clear this time..


    Thanks and have a great day!!

    Sincerly,
    DarkUndeadSpawn
  • DarkUndeadSpawnDarkUndeadSpawn Member Posts: 64
    Try giving your actors tags bounce/no bounce. In the ball's rule when actor collides w/ actor of tage bounce, (collide behavior )... Otherwise, change self.linearvelocity.y. to 0. You should probably lower the gravity. If you have both the acceleration and gravity set the same the ball will go in a straight line ( a lower gravity will make an arc bounce.)
    This Helped me a tad bit thanks..

    But im coming up with a problem i set the gravity to another but it still seems to only go one way still.. And it needs to bounce on surfaces like pinball but not as much..

    And having the windows beta is still in a glitchy process so i cannot add a actor tag for some reason..

    The self.linearvelocity.y. is already set to 0

    Im trying to work my way up to just normal type of gravity and just make it bounce when i launch it from a cannon in any way i want the cannon to launch..
  • kalash22kalash22 Member Posts: 1
    i had the same problem once,
    what i did was under the character i went to physics and under physics i found bounciness. i increased it to 200
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited June 2013
    I would set the main actors bounce in physics to zero. then set the bounce in each actor"s physics to a different bounce value as you like. Make sure you tag all actors you want the main actor to bounce with the same tag then just drag in a collide behavior to the main actor and select collide with actors with tag and select the tag. Remember bounce is very sensative and it's okay to set an actors bounce value in decimel places like .5 and such. Don't use a move behavior as that is used for precise directed movement you want to use an accelerate behavior, there you can select the first angle of direction but in the main actor do not check fixed rotation and this will allow the ball to spin on it's own, once the ball is in motion it will overcome the accelerate direction you set when it collides with other objects forcing it in another direction. You could also use a vector to angle expression too instead of the accelerate.
  • ericzingelerericzingeler Member Posts: 334
    edited June 2013
    +1 @FryingBaconStudios

    Wow, I was becoming more and more frightened with each and every post.

    Your mindset when working with physics in GameSalad should be: How can I achieve this without using any rules.

    General baseline bouncing guidelines:

    - At first, keep density of all moving actors to default value (mess around with this later)

    - Decide a minimum bounce amount for all actors in the scene. Bounciness attribute range = 0 or higher.

    Note: In your case, min should = 0; as sometimes no bouncing should occur.

    - Set your main bounce actor to your decided minimum amount.

    - Adjust the bounciness attribute of the actors that the main bounce actor will collide with. Bounciness attribute range = minimum or higher. So this is where you define how much the main actor bounces off of others.

    Why? To keep things simple, let's just say something like... an actor's bounce amount is based on the highest bounciness attribute value of the two colliding actors.

    Things get a little more complicated when you factor in stuff like density, size of actor, drag... Experiment with that if you're up to it.
  • DarkUndeadSpawnDarkUndeadSpawn Member Posts: 64
    I already fixed this and using simple functions to do it.
Sign In or Register to comment.