Author Topic: How do raycasts work?  (Read 756 times)

I was just wondering, cos now i've started work on my shockrifle weapon, it will need to be hitscan. Could someone run me over the basics? Thanks.

Automaticly hit's where you aim, like a scanner.

Automaticly hit's where you aim, like a scanner.
I think that he already knows that.

He hasn't really given enough infomation, whether he wants script detailes or stuff.

Code: [Select]
   //Raycasting Weapons settings
   raycastWeaponRange = 1000;
   raycastWeaponTargets = $TypeMasks::FxBrickObjectType | //Targets the weapon can hit: Raycasting Bricks
    $TypeMasks::PlayerObjectType | //AI/Players
    $TypeMasks::StaticObjectType | //Static Shapes
    $TypeMasks::TerrainObjectType | //Terrain
    $TypeMasks::VehicleObjectType; //Vehicles
   raycastWeaponPierceTargets = ""; //Gun cannot pierce
   raycastExplosionProjectile = gunprojectile;
   raycastExplosionSound = ""; //sound played by exploding gunprojectile
   raycastDirectDamage = 11;
   raycastDirectDamageType = $DamageType::TF2Shotgun;
   raycastSpreadCount = 5;
   raycastSpreadAmt = 0.0035;
   raycastTracerProjectile = TF2BulletTrailProjectile;
   raycastImpactImpulse = 0;
This is the Raycast code, taken from TF2Shotgun



This is the Raycast code, taken from TF2Shotgun
This will not be useful unless you have Space guy's raycast support script.

This will not be useful unless you have Space guy's raycast support script.

^

Since Space's are instant.

This will not be useful unless you have Space guy's raycast support script.

I knew that. :P