behavior - Runs on TGB viewer but not iPhone Simulator or iPhone
by Bruce Platti · in Torque Game Builder · 06/10/2009 (12:53 pm) · 2 replies
I wrote this behavior script to rotate the HOUR hand on a clock. The script runs and when I play the game via TGB, but when I run it for the iPhone it doesn't.
Any ideas?
iTGB:
A very basic project:
created a new project
added clock image and clock Hour Hand to the scene.
attached the behavior
ran the game
if (!isObject(ClockArmBehavior))
{
%template = new BehaviorTemplate(ClockArmBehavior);
%template.friendlyName = "Clock Arm Hours";
%template.behaviorType = "Game Logic";
%template.description = "Rotate the hours hand around the clock";
%template.addBehaviorField(rotSpeed, "rotate speed", float, "60");
%template.addBehaviorField(rotAngle, "rotate angle", float, "30.0");
}
function ClockArmBehavior::onBehaviorAdd(%this)
{
%this.schedule(100, "startClock");
}
function ClockArmBehavior::startClock(%this)
{
%this.owner.rotateTo(%this.owner.getRotation() + %this.rotAngle, %this.rotSpeed, true, true, true, 0.01);
}
function ClockArmBehavior::onRotationTarget(%this)
{
%this.schedule(1000, "startClock");
}
Any ideas?
iTGB:
A very basic project:
created a new project
added clock image and clock Hour Hand to the scene.
attached the behavior
ran the game
if (!isObject(ClockArmBehavior))
{
%template = new BehaviorTemplate(ClockArmBehavior);
%template.friendlyName = "Clock Arm Hours";
%template.behaviorType = "Game Logic";
%template.description = "Rotate the hours hand around the clock";
%template.addBehaviorField(rotSpeed, "rotate speed", float, "60");
%template.addBehaviorField(rotAngle, "rotate angle", float, "30.0");
}
function ClockArmBehavior::onBehaviorAdd(%this)
{
%this.schedule(100, "startClock");
}
function ClockArmBehavior::startClock(%this)
{
%this.owner.rotateTo(%this.owner.getRotation() + %this.rotAngle, %this.rotSpeed, true, true, true, 0.01);
}
function ClockArmBehavior::onRotationTarget(%this)
{
%this.schedule(1000, "startClock");
}
#2
07/29/2009 (4:44 pm)
I don't think behaviors work very well on iTGB... And even if they did, they would be much slower then normal. Because they need to go through the behavior, then the script, and then the code, rather then just through the script and code...
Torque 3D Owner Alexandru Colea
I used the Spawn Point Behavior from Platformer Pro kit and it works fine in TGB Viewer but not on the Simulator or iPhone.