Game Development Community

Issues with moveTo when optimizing on the iPhone

by Tariq Zaid · in iTorque 2D · 06/14/2009 (11:59 am) · 7 replies

Hi,

I've been having issues with the .moveTo function when using optimization flags with iTGB. I'm doing something fairly simple: I have a simple static sprite and I'm making it float across the screen (it's a cloud) to a specific destination. I'm only in the testing phase so there is literally no magic involved; it's a static sprite that I've added through the level editor and I make it move towards a valid destination on the screen.

The code I use to move the cloud is this:
%this.moveTo(DestinationCloud.getPosition(), 20, false, false, false, 0.8);

and this is invoked when the cloud is loaded (just to test).

What I'm seeing is that it works just fine when I compile with the 'iTGB' target that is provided by default, under release or debug. This is without any special optimization flags. This works both by doing 'runGame' in TGB and when compiling and running on the phone. (This is good).

When I switch over to the iTGB_Optimize, my sprites fail to move. To try to figure out what's happening, I debugged the 'moveTo' function in C++ and everything was getting invoked properly, yet nothing was moving.

So, this doesn't just happen with my cloud (it was the easiest example) but it happens with all of my other sprites as well. I first thought it was a configuration issue, but it's extremely bizarre that there are hidden surprises when trying to optimize some code with the provided optimization flags.

Some information:
-I'm compiling against the iPhone OS 3.0 GM Seed SDK.
-My objects have physics enabled

Does anyone have any suggestions on possible problems?

Thanks

#1
06/14/2009 (12:26 pm)
did you enable the physics on the object in question?
#2
06/14/2009 (1:10 pm)
Yep!

When I initialize the sprites, I enable physics by calling.

%this.setUsePhysics(true);

#3
06/14/2009 (3:28 pm)
Sorry, that's "setUsesPhysics" not, "setUsePhysics"
#4
06/15/2009 (8:21 pm)
Bumping. Is anyone else experiencing this problem? Am I doing something wrong? Should I file this as a bug?
#5
06/15/2009 (8:28 pm)
You need to call setUsesPhysics(true) on your moving objects. Make sure you have it spelled correctly.
#6
06/16/2009 (7:31 pm)
I have called it correctly and I do not get any warnings in the console when the methods are invoked which implies that A) It was properly compiled with the optimize flag and B) the method exists. Is there something else that I'm missing?
#7
06/17/2009 (8:17 am)
<erased message after further reading your description>

Forums need a delete button.