On the projectile of this head-homing weapon i got a similar piece of code, that works.
Code:
local raycast = SceneMan:CastMORay(ToHDFirearm(gun).MuzzlePos,Vector(self.weaponRange,0):RadRotate(ToActor(owner):GetAimAngle(true)),owner.ID,0,false,2);
The only difference is, that "gun" was defined before (since the script is on the projectile, not the gun).
Code:
local gun = MovableMan:GetMOFromID(i)
Same for owner
Code:
local owner = MovableMan:GetMOFromID(gun.RootID)
Comparison:
Working:local raycast =
SceneMan:CastMORay(ToHDFirearm(gun).MuzzlePos,Vector(self.weaponRange,0):RadRotate(ToActor(owner):GetAimAngle(true)),owner.ID,0,false,2);
Not-Working:local raycast =
SceneMan:CastMORay(ToHDFirearm(self).MuzzlePos,Vector(self.weaponRange,0):RadRotate(ToActor(self.owner):GetAimAngle(true)),self.owner.ID,0,false,2);
Could be that "self" doeas not contain the data I expect it to contain.