Projectile and Raycast problems
by Lukas Joergensen · in Torque Game Engine · 04/08/2009 (8:19 am) · 0 replies
I tried to make a raycast that could detect close to everything.. I'm using it for making a projectile i wrote this:
And now we are at it i would also like some support on my projectile DB because i'm pretty unsure whether i made it wrong.. I'm not getting any errors so far..
%rayInfo = ContainerRayCast(%start, %end, $TypeMask::StaticObjectType | $TypeMask::InteriorObjectType | $TypeMask::WaterObjectType | $TypeMask::ShapeBaseObjectType | $TypeMask::StaticShapeObjectType | $TypeMask::ItemObjectType | $TypeMask::TerrainObjectType | $TypeMask::StaticTSObjectType , %player);But it returns 0 no matter what i checked all variables it uses and they are all good..
And now we are at it i would also like some support on my projectile DB because i'm pretty unsure whether i made it wrong.. I'm not getting any errors so far..
datablock ProjectileData(SampleSpellProjectile)
{
projectileShapeName = "~/data/shapes/Projectiles/Projectile.dts";
muzzleVelocity = 2;
velInheritFactor = 0;
armingDelay = 0;
Explosion = SpellExplosion;
particleEmitter = ProjectileEmitter;
armingDelay = 0;
lifetime = 5000;
fadeDelay = 4800;
isBallistic = false;
bounceElasticity = 0;
bounceFriction = 0;
gravityMod = 0;
hasLight = true;
lightRadius = 3;
lightColor = "0.8 0.8 1.0";
};
function clientCmdDoSpell(%radius,%client,%type)
{
%radiusDamage = 8.0;
%pos = %client.player.getTransform();
%x = getWord(%pos, 0);
%y = getWord(%pos, 1);
%z = getWord(%pos, 2);
// adjust z value a bit...
%z += 2.0;
%finalPos = %x SPC %y SPC %z;
%eye = %client.player.getEyeVector();
%vec = vectorScale(%eye, 20);
%finalPos = vectorAdd(%finalPos, %vec);
//PROJECTILE
%clientplayer = %client.getcontrolobject();
if(getWord.castrayfromplayer = "setlifetime")
{
%setlifetime = true;
}
else{
%wordcount = getWordCount(castrayfromplayer(%this,%client));
%start = getWords(castrayfromplayer(%this,%client), 4);
%point = getWords(castrayfromplayer(%this,%client), 0, 3);
}
echo("%start = " SPC %start);
echo("%clientplayer.getTransform = " SPC %clientplayer.getTransform());
%bullet = new Projectile() {
dataBlock = SampleSpellProjectile;
//initialVelocity = %muzzleVelocity;
initialPosition = %start;
sourceObject = %client.player;
sourceSlot = %client.mount0;
//client = %client;
};
}About the author
IPS Bundle available at: https://www.winterleafentertainment.com/Products/IPS.aspx