Right now, I have 4 separate walls to box in the platform and the ball (no floor). All the Objects have a constant Force (9.8) applied to them up the global Z axis to make them float. The Platform also has all the logic set up so you can move it only in a given range (so it won’t go out of the box).
To start the game, the Ball gets a force (500 along Global X, 500 along Global Y) in the first logic tick.
Now my Problem is this:
(actually two problems, but one hasn’t happened yet)
1.) When the ball hits a wall, the wall spins off and flies away, which defeats the purpose of the game. How can i stop the ball from transferring any momentum to any of the walls?
2.) How do i prevent the Ball from ever losing any momentum/speed (it wouldn’t make sense if the Ball got slower because of air resistance or such…)
Can this be done with dynamic materials? Or changing world settings?
Please help! I’ve only just started with the BGE and don’t want to be warded off by such a thing as this!
1.) When the ball hits a wall, the wall spins off and flies away, which defeats the purpose of the game. How can i stop the ball from transferring any momentum to any of the walls?
The problem here is how you suspended the walls. they should not be dynamic. In the logic buttons select “Static” instead
2.) How do i prevent the Ball from ever losing any momentum/speed (it wouldn’t make sense if the Ball got slower because of air resistance or such…)
you could try using servo control to set the ball’s speed to be constant. you can either try some math to get the sum of the forces or you can have the ball constantly move at a steady forward rate and instead of bouncing change it’s rotation
This seems like a really great idea! - I mean what we know about those types of games (like air hockey) is that the angle of incidence is equal to the angle of reflection. I would try to do this one. The downside is that you’ll have to figure out the orientation matrix, which I still have trouble with. Go search for Social’s tutorial on it.
I tried this before and it worked pretty good, instead of giving everything a force of 9.8, go into the world settings in the shading buttons and set gravity to zero. make sure in the logic panel, anything you don’t want to move is static. in the shading buttons go to the dynamic, the dyn button under the color settings, and set the restitution to one, that will make it keep going at the same speed.
First, my thanks to you all for the quick responses and good answers.
@Rorkimaru: Setting the walls to “static” works! I think I tried the “static” before, but i guess i had the “Actor” setting off, so the ball just passed through.
Servo is also a good idea, but It doesn’t bounce and so would require some scripting. I guess i could use a sensor to check if the ball collides with anything (Touch), and use a Python controller where the attached script would then change the angle ( |180° - angle of incidence| ). I would have to use a material for the touch sensor though, because we also want blocks to disappear (and have a counter go up), but the wall and the Platform should stay.
@J09 & Jay_Dee_892: I guess I’ll have to learn the Orientation Matrix. (Can’t think what there would be 9 angles for though, when you only need 3 for rotation in 3D space. maybe it also saves Location and Scale?)
@mcguinnessdr: Setting gravity to 0 does save me the need of that Anti Gravity force. Dunno why I didn’t think of it, its such a simple solution. But (as someone whose name i don’t remember said: ) the simplest solutions are the hardest to find. Tried the Dynamic Texture restitution to 1, but That still didn’t stop the ball from slowing down.
Thanks again for all your prompt answers! I will try to host the result of this somewhere when it is finished. (BTW J09, your resources page is great!)
The 9 angles are as follows, I believe.
[1,2,3] = X,Y, Z rotations in the world X coordination,
[4,5,6] = X,Y, Z rotations in the world Y coordination,
[7,8,9] = X,Y, Z rotations in the world Z coordination
That being said, PLEASE SIMPLIFY OBJECT ROTATIONS, BGE DEVS! PLEASE!