like this
online though it is kinda fked, you can see that the seperate beams rotate to the HitLocation but they go the wrong way.
My guess is that the vector named MoveAmount is fked or something
Code: Select all
in the sniperclass
simulated function SpawnEffect(vector HitLocation, vector SmokeLocation)
{
local SniperEffect Smoke;
local Vector DVector;
local float NumPoints;
local rotator SmokeRotation;
DVector = HitLocation - SmokeLocation;
NumPoints = VSize(DVector)/32;
if ( NumPoints < 2.5 )
return;
SmokeRotation = rotator(DVector);
Smoke = Spawn(class'VRNSniper.SniperEffect',,,SmokeLocation,SmokeRotation);
Smoke.MoveAmount = DVector/NumPoints;
Smoke.NumPuffs = NumPoints - 1;
if(Affector.IsA('UDamage'))
Smoke.Texture = Texture'VRNSniper.PlasmaRifle.SniperBeam2';
}
Code: Select all
class SniperEffect expands Effects;
var vector MoveAmount;
var int NumPuffs;
replication
{
// Things the server should send to the client.
unreliable if( Role==ROLE_Authority )
MoveAmount, NumPuffs;
}
simulated function Tick( float DeltaTime )
{
if ( Level.NetMode != NM_DedicatedServer )
{
ScaleGlow = (Lifespan/Default.Lifespan)*0.6;
AmbientGlow = ScaleGlow * 210;
}
}
simulated function PostBeginPlay()
{
if ( Level.NetMode != NM_DedicatedServer )
SetTimer(0.005, false);
}
simulated function Timer()
{
local SniperEffect r;
if (NumPuffs>0)
{
r = Spawn(class'VRNSniper.SniperEffect',,,Location+MoveAmount,Rotation);
r.RemoteRole = ROLE_None;
r.NumPuffs = NumPuffs -1;
r.MoveAmount = MoveAmount;
r.Texture = Texture;
}
}
does this confirm my thoughts?Vectors and Rotators: To improve bandwidth efficiency, Unreal reduces the accuracy of vectors and rotators slightly, a process known as quantizing. The X, Y, Z components of vectors are converted to 16-bit signed integers before being sent, thus any fractional values or values out of the range -32768..32767 are lost. The Pitch, Yaw, Roll components of vectors are converted to bytes, of the form (Pitch8)&255. So, you need to be careful with vectors and rotators. If you absolutely must have full precision, then use int or float variables for the individual components; all other data types are sent with their complete precision.
and can someone help me how i should write the code to
thx in advanceIf you absolutely must have full precision, then use int or float variables for the individual components; all other data types are sent with their complete precision.