Physics not working...
by Daniel Hopkins · in iTorque 2D · 12/02/2009 (3:09 pm) · 6 replies
I apologize if this had been asked before, but I did a search and all the explanations I found as to how to fix it don't seem to be working.
I have a simple pong game with a touch controlled paddle and ball. The ball has "circle" bounds and is set to "bounce" for collision with other objects as well as the world bounds (which are set around the perimeter of the screen. I then set the linear velocity of the ball, and it will bounce around on the screen and interact with the paddle. Ok, so everything runs fine from the both the editor on my PC as well as the one on my Mac. I can even compile it for the simulator and everything still runs fine. However, when I compile it for the iTouch, the ball doesn't go anywhere. The paddle responds to my touch, but the ball just won't move.
I then did a search and found a solution--the [object].setUsesPhysics(true) function. So, I added this code into the "game/gamescripts/game.cs" script file:
When compiled and run on the device, the "I'm here!!!" text is displayed in the GDB--confirming the function is being executed. However, the ball still won't move. The odd thing about it all is that the ball used to move, but at some point (I guess I inadvertently did something) it stopped.
Any help would be greatly appreciated!
I have a simple pong game with a touch controlled paddle and ball. The ball has "circle" bounds and is set to "bounce" for collision with other objects as well as the world bounds (which are set around the perimeter of the screen. I then set the linear velocity of the ball, and it will bounce around on the screen and interact with the paddle. Ok, so everything runs fine from the both the editor on my PC as well as the one on my Mac. I can even compile it for the simulator and everything still runs fine. However, when I compile it for the iTouch, the ball doesn't go anywhere. The paddle responds to my touch, but the ball just won't move.
I then did a search and found a solution--the [object].setUsesPhysics(true) function. So, I added this code into the "game/gamescripts/game.cs" script file:
function bubbleBall::onLevelLoaded(%this,%scenegraph)
{
echo("I'm here!!!");
%this.setUsesPhysics(true);
%this.setLinearVelocity(80,60);
} When compiled and run on the device, the "I'm here!!!" text is displayed in the GDB--confirming the function is being executed. However, the ball still won't move. The odd thing about it all is that the ball used to move, but at some point (I guess I inadvertently did something) it stopped.
Any help would be greatly appreciated!
#2
I just did another test only this time I removed "PUAP_OPTIMIZE." After compiling and running, it still doesn't work. So, I guess the problem has nothing to do with the physics optimizations?
12/02/2009 (3:37 pm)
@Marc: Thanks for the reply! I checked and I have no behaviors attached to the ball and no calls to disable physics. I just did another test only this time I removed "PUAP_OPTIMIZE." After compiling and running, it still doesn't work. So, I guess the problem has nothing to do with the physics optimizations?
#3
Any ideas/suggestions are welcome! As I don't mean to be a pain, I won't bump the thread again. I guess if no one answers, I'll just have to wait for the official release of 1.3 and hope the problem is resolved.
Thanks.
12/11/2009 (9:30 pm)
I don't mean to nag, but I would really like to get this issue solved if possible. I contacted GG's iTGB support a week or two ago and haven't received a reply.Any ideas/suggestions are welcome! As I don't mean to be a pain, I won't bump the thread again. I guess if no one answers, I'll just have to wait for the official release of 1.3 and hope the problem is resolved.
Thanks.
#4
Have you looked at the included test game with the bouncing balls? It's a good example to compare to your code.
12/11/2009 (9:57 pm)
GG have been moving to Vegas and changing name to TP, so they've been a bit busy. I think they've started to get settled now, but your best bet for help during weekends is the IRC channel :)Have you looked at the included test game with the bouncing balls? It's a good example to compare to your code.
#5
Actually I haven't. I just installed it, and everything works fine, so I'll definately have to see what they're doing that I'm not. Thanks for the help!
12/11/2009 (11:33 pm)
@Ronny: I figured that was why :) I'm not complaining about it, just saying I've tried all I knew and would like to get the ball rolling (or moving at all :D) soon. How do I get to the IRC channel?Actually I haven't. I just installed it, and everything works fine, so I'll definately have to see what they're doing that I'm not. Thanks for the help!
#6
12/12/2009 (12:03 am)
Server irc.maxgaming.net, channel #garagegames gets you there.
Torque 3D Owner Marc Dreamora Schaerer
Gayasoft