Data Realms Fan Forums http://45.55.195.193/ |
|
Help - Homing for the head http://45.55.195.193/viewtopic.php?f=1&t=25592 |
Page 1 of 1 |
Author: | The5 [ Tue Sep 20, 2011 11:47 am ] |
Post subject: | Help - Homing for the head |
Heads are only attachables, so all i can do is aim for Code: ClassName == "Attachable" but that wont quite cut it. The forum search brought up that someone already created a weapon that god head-homing ammunition, but I can't find said mod, also it seems this mod is years old and with the new lua stuff there should be a better way already. I can do the target finding and the projectile moving/aiming but how to get the head from the targeted actor? OFFTOPIC: Is there some official CC chat/IRC? |
Author: | CaveCricket48 [ Tue Sep 20, 2011 2:47 pm ] |
Post subject: | Re: Help - Homing for the head |
Try: Code: ToAHuman(actor).Head Source. |
Author: | The5 [ Tue Sep 20, 2011 3:31 pm ] |
Post subject: | Re: Help - Homing for the head |
Thanks! Seems the wiki actualy got some usefull information, at least for lua. So this should work I suppose? Code: self.targetHeadPos = ToAHuman(target).Head.Pos |
Author: | The5 [ Tue Sep 20, 2011 4:02 pm ] |
Post subject: | Re: Help - Homing for the head |
Hmm I use "local raycast = SceneMan:CastMORay(...)" to get a MO in the line of sight. How to check wether it is a AHuman? Code: if raycast ~= 255 and ToAHuman(targetID) ~= nil then this seems not to work :/ EDIT: This works, but it fails for actors without head like crabs Code: local raycast = SceneMan:CastMORay(ToHDFirearm(gun).MuzzlePos,Vector(self.weaponRange,0):RadRotate(ToActor(owner):GetAimAngle(true)),owner.ID,0,false,2); if raycast ~= 255 then local raycast2 = MovableMan:GetMOFromID(MovableMan:GetMOFromID(raycast).RootID); if MovableMan:IsActor(raycast2) then self.target = raycast2; end end EDIT: Solved! Code: local raycast = SceneMan:CastMORay(ToHDFirearm(gun).MuzzlePos,Vector(self.weaponRange,0):RadRotate(ToActor(owner):GetAimAngle(true)),owner.ID,0,false,2); if raycast ~= 255 then local raycast2 = MovableMan:GetMOFromID(MovableMan:GetMOFromID(raycast).RootID); if raycast2.ClassName == "AHuman" then self.target = raycast2; end end |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |