public override void Throw(Vec3f velocity) { var gVel = gAI.Velocity; velocity.SetGVec(gVel); SetPhysics(true); var rb = Process.ReadInt(gVob.Address + 224); Process.THISCALL <NullReturnCall>(rb, 0x5B66D0, gVel); }
static void CalcRangedTrace(NPCInst npc, out Vec3f start, out Vec3f end) { Vec3f projStartPos; using (var matrix = Gothic.Types.zMat4.Create()) { var weapon = npc.GetDrawnWeapon(); var node = (weapon == null || weapon.ItemType == ItemTypes.WepBow) ? oCNpc.NPCNodes.RightHand : oCNpc.NPCNodes.LeftHand; npc.BaseInst.gVob.GetTrafoModelNodeToWorld(node, matrix); projStartPos = (Vec3f)matrix.Position; } const zCWorld.zTraceRay traceType = zCWorld.zTraceRay.Ignore_Alpha | zCWorld.zTraceRay.Ignore_Projectiles | zCWorld.zTraceRay.Ignore_Vob_No_Collision | zCWorld.zTraceRay.Ignore_NPC; var camVob = GothicGlobals.Game.GetCameraVob(); start = (Vec3f)camVob.Position; Vec3f ray = 500000f * (Vec3f)camVob.Direction; end = start + ray; using (var zStart = start.CreateGVec()) using (var zRay = ray.CreateGVec()) { var gWorld = GothicGlobals.Game.GetWorld(); if (gWorld.TraceRayNearestHit(zStart, zRay, traceType)) { end = (Vec3f)gWorld.Raytrace_FoundIntersection; } start = projStartPos; ray = end - start; start.SetGVec(zStart); ray.SetGVec(zRay); if (gWorld.TraceRayNearestHit(zStart, zRay, traceType)) { end = (Vec3f)gWorld.Raytrace_FoundIntersection; } } }