How can i make a ball bounce on only actors i want it only to bounce on?
DarkUndeadSpawn
Member Posts: 64
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..
Sincerly,
DarkUndeadSpawn
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:Tell me if i did something wrong?
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)
New Rule:I need to know so i can fix this problem.
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 )
New Rule:Thankyou and have a nice day.
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)
Sincerly,
DarkUndeadSpawn
Best Answers
-
LumpApps Posts: 2,881Start 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_Guru Posts: 9,922You 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.
-
Nmdogdude Posts: 174Try 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.)
Answers
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
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..
I wonder how i can fix this problem..
I need a solution please i hope this was more clear this time..
Thanks and have a great day!!
Sincerly,
DarkUndeadSpawn
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..
what i did was under the character i went to physics and under physics i found bounciness. i increased it to 200
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
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.