Armor Piercing Rounds T3D 1.2 Porting Problems[Fixed]
by CSMP · in Torque 3D Professional · 04/27/2012 (1:53 pm) · 4 replies
Hey guys, It's been awhile but I've looked up my old AP Rounds Resource for TGE and I've successfully gotten it to compile in T3D 1.2, However...
There were some code differances between TGE and T3D (obviously) that have gotten me stuck as far as getting the resource working, I've removed the Multiple Decal's(un-needed with T3D anyway) and explodeOnWater.
Edit: I have gotten some good results while testing some changes, I am now encountering an engine crash that has to do with the resource but AP Rounds are currently working... Please feel free to try this and if possible I would love to know your results.
Current Problems: I've noticed that the code is calling the explode() function twice and atm the game is crashing while going into a building mesh... maybe trying to show the "exit" decal on meshes that are too thick is crashing it... Still testing this
Edit2: Everything may be working, there is only one change between my current "working" code and the AP_Core_v2.zip file.
In AP Core v2.zip/projectile.cpp at line 1251, replace with this:
Original Resource located here: www.garagegames.com/community/resources/view/18147
T3D 1.2 Port files are located here: csmp.angelfire.com/DLs/AP_Core_v2.zip
Script Changes for the current system are:
Inside of your Projectile Datablock:
Inside of your "WeaponImage"::onFire function modify the projectile spawning:
Add this Projectile function, replace "YourBullet" with the the AP projectile:
There were some code differances between TGE and T3D (obviously) that have gotten me stuck as far as getting the resource working, I've removed the Multiple Decal's(un-needed with T3D anyway) and explodeOnWater.
Edit: I have gotten some good results while testing some changes, I am now encountering an engine crash that has to do with the resource but AP Rounds are currently working... Please feel free to try this and if possible I would love to know your results.
Current Problems: I've noticed that the code is calling the explode() function twice and atm the game is crashing while going into a building mesh... maybe trying to show the "exit" decal on meshes that are too thick is crashing it... Still testing this
Edit2: Everything may be working, there is only one change between my current "working" code and the AP_Core_v2.zip file.
In AP Core v2.zip/projectile.cpp at line 1251, replace with this:
mPiercePosition = mCurrPosition + savedCurrVelocity * 0.0003f;The 0.0003f should be the penetration length that I brought back down from 0.0005f, but more importantly there was a double ;; that should not have been there, and apparently the engine crash was not related to the resource.
Original Resource located here: www.garagegames.com/community/resources/view/18147
T3D 1.2 Port files are located here: csmp.angelfire.com/DLs/AP_Core_v2.zip
Script Changes for the current system are:
Inside of your Projectile Datablock:
// / / AP + Projectiles / / playerExplosion = BulletBloodExplosion; //need your own blood explosion here vehicleExplosion = BulletMetalExplosion; //need your own vehicle explosion here pierceOffset = "1 1 1"; // / / AP + Projectiles / /
Inside of your "WeaponImage"::onFire function modify the projectile spawning:
// Create our projectile
%p = new (%this.projectileType)()
{
dataBlock = %projectile;
initialVelocity = %velocity;
initialPosition = %obj.getMuzzlePoint(%slot);
sourceObject = %obj;
sourceSlot = %slot;
client = %obj.client;
isArmorPiercing = true; //this is the original bullet, AP Resource
};
MissionCleanup.add(%p);
}
return %p;
}Add this Projectile function, replace "YourBullet" with the the AP projectile:
function YourBullet::onPierce(%this,%obj,%startPos,%startVel){
//Put together a dummy projectile
//%this = projectile's datablock
//%obj = the projectile instance
// Create the projectile object;
%weaponImage = %obj.sourceObject.getMountedImage($WeaponSlot);
%p = new (%weaponImage.projectileType)() {
dataBlock = %this;
initialVelocity = %startVel;
initialPosition = %startPos;
sourceObject = %obj.sourceObject;
sourceSlot = %obj.sourceSlot;
client = %obj.client;
isArmorPiercing = false; //this is the second bullet...
};
MissionCleanup.add(%p);
return %p;
}
Torque Owner CSMP
MP Studios