Physics settings don't work in iPhone simulator (?)
by Tyler Schlegel · in iTorque 2D · 02/21/2009 (12:21 am) · 10 replies
I just bought iTGB yesterday, and I'm checking out some of the tutorials. I got this animated sprite flour sack thing working in TGB so that he walks across the screen by simply tweaking the x velocity. Great. But, when I run this in the iPhone simulator the animation just plays in place and there's no motion in the x-axis.
#2
I have also tried
The odd part is without trying to set physics to true, 3 of my %images work, while the other 6 don't. They are all created the same way. Anyone else had issues with multiple objects created from the same datablock having physic issues?
Thanks
Dane
02/21/2009 (3:53 pm)
I think I am having a similar issue with the Physics. on my datablocks I tried adding Physics =true;I have also tried
%image.usePhysics = true;after the creation of a new %image. My collision callbacks are still not working.
The odd part is without trying to set physics to true, 3 of my %images work, while the other 6 don't. They are all created the same way. Anyone else had issues with multiple objects created from the same datablock having physic issues?
Thanks
Dane
#3
Only thing I can think of to suggest is to remove all your dso's and do a clean build of everything. I've since rebuilt iTGB itself to ensure the PUAP_OPTIMIZE etc compile flags are the same as my game built version is for the iphone. I haven't seen the problem since then, but I haven't had time in the last 2 months to work with iTGB much.
02/21/2009 (4:38 pm)
Yes this part of iTGBis very unpredictable. I experienced the same thing many times. I never figured out what ended up fixing it everytime. I added in the setUsePhysics and just got a bunch of print outs that the method didn't exist and things still didn't work. Eventually after shutting down xcode and iTGB and rebuilding a few times things magically started working. I'm still not clear as to what caused it.Only thing I can think of to suggest is to remove all your dso's and do a clean build of everything. I've since rebuilt iTGB itself to ensure the PUAP_OPTIMIZE etc compile flags are the same as my game built version is for the iphone. I haven't seen the problem since then, but I haven't had time in the last 2 months to work with iTGB much.
#4
Basically, it took me about two hours of screwing around to get this flour sack animation to move across the screen, and I wouldn't have even known to do this if I hadn't posted on this forum. Does anyone know if there's some real docs out there for this iTGB stuff? All of the tutorials and other docs for TGB are useless if small omissions like this cause such huge productivity losses.
02/21/2009 (4:58 pm)
So, the actual method you need to call is "setUsesPhysics." It would be nice if the TGB player didn't ignore this (?!) as it seems to do, because I had to go through the tedious rebuild in Xcode several times, and experiment with the correct method name.function playerSack::onLevelLoaded(%this, %scenegraph)
{
%this.setUsesPhysics(true);
%this.setLinearVelocityX(20);
}Basically, it took me about two hours of screwing around to get this flour sack animation to move across the screen, and I wouldn't have even known to do this if I hadn't posted on this forum. Does anyone know if there's some real docs out there for this iTGB stuff? All of the tutorials and other docs for TGB are useless if small omissions like this cause such huge productivity losses.
#5
It will tell you which compiler directives you need to have to enable the same behavior on the desktop versions as well.
But never forget: What TGBGame shows you is commonly slightly to very different from what you will see on the iphone so also do common tests on the iphone simulator / device
02/21/2009 (5:29 pm)
Please check the stickies at the top.It will tell you which compiler directives you need to have to enable the same behavior on the desktop versions as well.
But never forget: What TGBGame shows you is commonly slightly to very different from what you will see on the iphone so also do common tests on the iphone simulator / device
#6
I am on the same boat as Tyler. How are we supposed to know what statements there are? The only reason I have made it this far is because of the forum help and opening up tons of others cs files. But when you can't find it in there you have to pray someone else has the answer.
Atleast this bug is cleared up, now on to the next :D.
Thanks again guys,
Dane
02/21/2009 (5:35 pm)
Thanks Tyler, it was the way I was setting the Physics. I had %image.setUsePhysics(true);and not
%image.setUsesPhysics(true);
I am on the same boat as Tyler. How are we supposed to know what statements there are? The only reason I have made it this far is because of the forum help and opening up tons of others cs files. But when you can't find it in there you have to pray someone else has the answer.
Atleast this bug is cleared up, now on to the next :D.
Thanks again guys,
Dane
#7
I would also get familiar with the examples, just to see how things can be done, and definately make sure that your projects match across systems (i.e. preprocessor defines the same on all your projects).
02/21/2009 (5:42 pm)
Chck the Cheat Sheet especially, it was made because people on this forum had the same problems you're having.I would also get familiar with the examples, just to see how things can be done, and definately make sure that your projects match across systems (i.e. preprocessor defines the same on all your projects).
#8
I'm new to iTGB, and I'm having a lot of problems gettinge even the most simplest things to work (things that are trivial 5 minute tasks in TGB). I have created a simple level with just one object that has a constant velocity in the x direction, with walls on either side so that the object bounces back and forth. The desktop, iPhone simulator, and iPhone device all behave differently:
1) Desktop (regular TGB): works ok
2) iPhone simulator: nothing moves (the object remains static)
3) iPhone device: The object moves, but disappears off the screen (collisions not working correctly)
My question is, what am I supposed to do to get physics working consistently on all three platforms? I've checked the "Use Physics" option in the TGB editor, does this have the same effect as executing a "setUsesPhysics(true)" from a script?
I've been playing around with iTGB for a few days already, and although I can get things to work very easily in regular TGB, I have achieved very little so far with iTGB and I'm starting to lose confidence it it. So far I have not found a single tutorial that works. Where are the tutorials?
Thanks,
Mark
03/28/2010 (10:42 pm)
Hi all,I'm new to iTGB, and I'm having a lot of problems gettinge even the most simplest things to work (things that are trivial 5 minute tasks in TGB). I have created a simple level with just one object that has a constant velocity in the x direction, with walls on either side so that the object bounces back and forth. The desktop, iPhone simulator, and iPhone device all behave differently:
1) Desktop (regular TGB): works ok
2) iPhone simulator: nothing moves (the object remains static)
3) iPhone device: The object moves, but disappears off the screen (collisions not working correctly)
My question is, what am I supposed to do to get physics working consistently on all three platforms? I've checked the "Use Physics" option in the TGB editor, does this have the same effect as executing a "setUsesPhysics(true)" from a script?
I've been playing around with iTGB for a few days already, and although I can get things to work very easily in regular TGB, I have achieved very little so far with iTGB and I'm starting to lose confidence it it. So far I have not found a single tutorial that works. Where are the tutorials?
Thanks,
Mark
#9
I have been able to get my app running on all three platforms. At least I managed to answer my own question regarding the "Use Physics"; Checking this option in the iTGB editor does work correctly as expected. In the end I fixed my problem by checking send and receive collisions. After I did that, all three platforms now behave the same way. I have no understanding of why the iPhone simulator behaved differently to the iPhone device in my previous version, but it works now so I will ignore this problem for now. Also, it is weird that everything was already working correctly on the desktop version even with the previous physics settings. It's a bit worrying that there are so many (undocumented) gotchas, when going from TGB to iTGB.
ps. I am thinking of creating a short tutorial on the work I've done so far, which will explain how to create and run a simple app on all three platforms (desktop, iPhone sim, and iPhone device). I am doing this for my own benefit, but I could probably post it here if anyone is interested? It might be helpful for a noob (like me) who is tackling the first few steps of writing a simple app and running it on the device.
Thanks,
Mark
03/28/2010 (11:31 pm)
Hi all,I have been able to get my app running on all three platforms. At least I managed to answer my own question regarding the "Use Physics"; Checking this option in the iTGB editor does work correctly as expected. In the end I fixed my problem by checking send and receive collisions. After I did that, all three platforms now behave the same way. I have no understanding of why the iPhone simulator behaved differently to the iPhone device in my previous version, but it works now so I will ignore this problem for now. Also, it is weird that everything was already working correctly on the desktop version even with the previous physics settings. It's a bit worrying that there are so many (undocumented) gotchas, when going from TGB to iTGB.
ps. I am thinking of creating a short tutorial on the work I've done so far, which will explain how to create and run a simple app on all three platforms (desktop, iPhone sim, and iPhone device). I am doing this for my own benefit, but I could probably post it here if anyone is interested? It might be helpful for a noob (like me) who is tackling the first few steps of writing a simple app and running it on the device.
Thanks,
Mark
#10
03/29/2010 (1:34 pm)
A gotcha list would be very welcome!
Torque 3D Owner Marc Dreamora Schaerer
Gayasoft
iTGB is not TGB and you will have to change various things.
In this case SetUsePhysics(true) on each object you want to use physics.
Physics is very costly so you want to enable it only on those objects that really need it