Bullets: iTGB fails, TGB works
by Brooks Talley · in Torque Game Builder · 11/20/2009 (2:01 pm) · 1 replies
I'm starting to play with iPhone compilation, and overall I'm pretty impressed. Almost everything comes across and works as expected.
The one big exception is the projectiles that my tanks are firing. They are created and sent on their way with:
It works great in TGB. Once compiled and deployed to an iPhone, the bullets are created... and then just sit there. They don't move. They're more like mines, where another tank can drive into them and get hurt, but that's not the generally accepted mode of operation for bullets.
I'm not even sure where to start for troubleshooting. Ideas?
The one big exception is the projectiles that my tanks are firing. They are created and sent on their way with:
%bulletDatablockName = %tank.team @ "BulletDatablock";
%bullet = t2dStaticSprite() {
scenegraph = %tank.scenegraph;
config = %bulletDatablockName;
};
%bullet.setPosition( %tank.getPosition );
%bullet.setLinearVelocityPolar ( %angle, %bullet.speed);
%bullet.shooter = %tank;
}It works great in TGB. Once compiled and deployed to an iPhone, the bullets are created... and then just sit there. They don't move. They're more like mines, where another tank can drive into them and get hurt, but that's not the generally accepted mode of operation for bullets.
I'm not even sure where to start for troubleshooting. Ideas?
Associate Sven Bergström
Luma Arcade
Some notes :
a) There is a dedicated forum for iPhone torque in your Community / Forums / Engines Rollout.
here is a link : http://www.garagegames.com/community/forums/56
b) Rather post in there, as this is unrelated to TGB but rather to iTGB (and i dont lurk here as often as i do there). For direct iPhone support post in the above forum.
The solution
For iPhone T2D, Physics on objects is diabled by default. Select the bullets and enable the physics in order to allow the physics system to control them.
Inside the level file (levelName.t2d inside the levels folder) check the items have :
UsesPhysics = "1"; CollisionActiveSend = "1"; CollisionActiveReceive = "1"; CollisionPhysicsSend = "1"; CollisionPhysicsReceive = "1";The above enables physics and collision, you decide whats best for performance on a mobile device. The editor of course exposes these flags too :)