FatKat Posted August 11, 2015 Share Posted August 11, 2015 Hello I am relatively new to T3D and programming/scripting. I have done the FPS video and have a few T3D books including David Wyand's "T3D Game Development Cookbool," Brad Strong's "Creating game art for 3d Engines" and Finney's 3rd edition "3D Game Programming All in One." I am also waiting on Fritzen's online book but did not get a download link after using paypal. I would prefer to implement Destructible Objects without Physx is this possible? Do people have advice or examples of how to accomplish this? Preferably the solution would be open source and ideally MIT/BSD/Zlib. Any help on this would be appreciated.link to this post at garage games:https://www.garagegames.com/community/forums/viewthread/142553 Quote Link to comment Share on other sites More sharing options...
Azaezel Posted August 11, 2015 Share Posted August 11, 2015 Ancient code is ancient, but you mean somethin like this? function RigidShapeData::onDisabled(%this,%obj,%state) { %obj.setDamageFlash(0.75); radiusDamage(%obj, %obj.getPosition(), %obj.dataBlock.explosionRadius, %obj.dataBlock.explosionDamage, 1, 500.0); // Schedule corpse removal. Just keeping the place clean. //%obj.schedule($RigidShapeTimeoutValue - 1000, "startFade", 1000, 0, true); %obj.schedule($RigidShapeTimeoutValue, "delete"); schedule($RigidShapeTimeoutValue + 1, 0, "createsubobject", %obj.getTransform(), %obj.dataBlock.subobject, %obj.dataBlock.subobjectcount, %obj.dataBlock.explosionRadius); } function createsubobject(%pos, %data, %count, %radius) { %mask = ($TypeMasks::VehicleObjectType); for (%i=0; %i < %count; %i++) { %x = getword(%pos,0) + (getRandom() - 0.5) * %radius; %y = getword(%pos,1) + (getRandom() - 0.5) * %radius; %z = getword(%pos,2) + (getRandom() - 0.5) * %radius; %subpos = %x SPC %y SPC %z SPC "1 0 0 0"; if (ContainerBoxEmpty(%mask, %subpos, %radius/4)) { %newsub = %data.create(%data); %newsub.setTransform(%subpos); // Apply the impulse %impulseVec = VectorSub(%subpos,%pos); %impulseVec = VectorNormalize(%impulseVec); %impulseVec = VectorScale(%impulseVec, 200); %newsub.applyImpulse(%subpos, %impulseVec); //error(%impulseVec); MissionCleanup.Add(%newsub); } } } //----------------------------------------------------------------------------- datablock RigidShapeData( Asteroid1 ) { category = "RigidShape"; shapeFile = "scriptsAndAssets/data/shapes/rocks/asteroid.DTS"; emap = true; // Rigid Body mass = 50; massCenter = "0 0 0"; // Center of mass for rigid body massBox = "0 0 0"; // Size of box used for moment of inertia, // if zero it defaults to object bounding box drag = 0.0; // Drag coefficient bodyFriction = 0.0; bodyRestitution = 0.1; minImpactSpeed = 1; // Impacts over this invoke the script callback softImpactSpeed = 1; // Play SoftImpact Sound hardImpactSpeed = 2; // Play HardImpact Sound integration = 64; // Physics integration: TickSec/Rate collisionTol = 0.1; // Collision distance tolerance contactTol = 0.1; // Contact velocity tolerance minRollSpeed = 10; maxDrag = 0.0; minDrag = 0.00; triggerDustHeight = 1; dustHeight = 10; dragForce = 0.05; vertFactor = 0.05; normalForce = 0.5; restorativeForce = 0.5; rollForce = 0.5; pitchForce = 0.5; Gravity = 0.0; // Explosion and debris setup explosion = SmallExplosion; underwaterExplosion = SmallExplosion; explosionDamage = 20; // How much damage is applied through a radiusDamage function call explosionRadius = 20; // the radius for the radiusDamage function call //also deytermines radius for subspawns debris = ScoutDebris; // the debris datablock renderWhenDestroyed = false; // don't render normal shape when destroyed, only debris shape subobject = NULL; subobjectcount = 0; name = "Asteroid"; maxDamage = 1; // total damage until explosion destroyedLevel = 1.40; maxEnergy = 1000; energyPerDamagePoint = 1; rechargeRate = 0.1; }; datablock RigidShapeData( Asteroid2 : Asteroid1 ) { shapeFile = "scriptsAndAssets/data/shapes/rocks/asteroid2.DTS"; maxDamage = 10; // total damage until explosion mass = 100; explosion = MediumExplosion; underwaterExplosion = MediumExplosion; explosionDamage = 80; explosionRadius = 80; subobject = Asteroid1; subobjectcount = 8; name = "Asteroid"; }; datablock RigidShapeData( Asteroid3 : Asteroid1 ) { shapeFile = "scriptsAndAssets/data/shapes/rocks/asteroid3.DTS"; maxDamage = 100; // total damage until explosion mass = 500; explosion = LargeExplosion; underwaterExplosion = LargeExplosion; explosionDamage = 160; explosionRadius = 160; subobject = Asteroid2; subobjectcount = 4; name = "Asteroid"; }; Quote Link to comment Share on other sites More sharing options...
buckmaster Posted August 11, 2015 Share Posted August 11, 2015 There was an excellent tutorial series on simple destroyable shapes. I collected all the links here but haven't ported them to the wiki yet. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.