Game Development Community

rotateTo don't work using iPhone

by Michele Condo' · in iTorque 2D · 03/19/2011 (11:13 am) · 2 replies

Hi to all!
I've a question about this strange behavior.

I've a schedule, that every 100ms an object must rotate. I've used the method t2dSceneObject.rotateTo.
This work perfectly when I use it on the TGB, but when I use in xcode (simulator or device, for ipad) the object move well but not rotate.


To be more precise:

function oniPhoneTouchDown(%touchCount, %touchX, %touchY) {
        %curX = getWord(%touchX, 0);
        %curY = getWord(%touchY, 0);
	%worldPos = sceneWindow2D.getWorldPoint( %curX SPC %curY );

   	%scenegraph = sceneWindow2D.getSceneGraph();  
   	%objects = %scenegraph.pickPoint(%worldPos.x, %worldPos.y);  
   	for (%i = 0; %i < getWordCount(%objects); %i++) {  
      	      %object = getWord(%objects, %i);  
      	      if (%object.getName() $= "itemToFind") {
      	           $itemObj = %object;

                   $itemObj.rotateTo(90, 45.0, true, false, true, 0.1); // see here
      	           break;
   	      }
	}
}

The rotateTo, don't rotate the object find.

Any suggest about this strange behavior?

Thanks a lot.

Michele

#1
03/20/2011 (9:48 am)
ok ok.
The setRotate work well.. but rotateTo not working using oniPhoneTouch* .. why? There is a reason?

Thanks to all :)

Bye!
#2
03/22/2011 (2:12 am)
Ok, solve, sorry for mistake. I don't know that for iphone need to set "Uses Physics", because in tgb editor work perfectly.

Sorry again ^^