Начинающий
-
Автор темы
- #1
знаю, что реализация не из самых лучших, но пастеры с девблогов все сожрут, так что похуй
code:
code:
C++:
if (vars::weapon::bullet_tp && target.player && prj->authoritative() && prj->IsAlive())
{
auto player_update = il2cpp::methods::object_new(il2cpp::init_class(("PlayerProjectileUpdate"), ("ProtoBuf")));
auto current_position = prj->get_transform()->get_bone_position();
transform* bonetrans = target.player->get_bone_transform(48);
Vector target_bone = target.player->get_player_model2()->position() + Vector(0, 1.49f, 0);
auto dist = target_bone.distance(current_position);
for (Projectile* i = prj; prj->IsAlive(); i->UpdateVelocity(0.01)) {
Vector a = prj->currentVelocity() * get_deltaTime();
float magnitude = a.Length();
float radius = (prj->traveledTime() + magnitude / prj->currentPosition().Distance(target_bone)) * (local_player->get_bone_transform(48)->get_bone_position().distance(target_bone) / 25.f);
if (dist < radius && utils::LineOfSight(target_bone, current_position) )
{
auto newpos = MoveTowards(current_position, target_bone, 1.9f);
auto hits = target_bone - prj->currentPosition();
HitTest* ht = (HitTest*)prj->get_hit_test();
if (!ht)
return;
safe_write(player_update + 0x10, prj->projectileID(), int);
safe_write(player_update + 0x14, prj->currentPosition(), Vector);
safe_write(player_update + 0x20, prj->currentVelocity(), Vector);
safe_write(player_update + 0x2C, prj->traveledTime(), float);
SendProjectileUpdate(local_player, player_update);
safe_write(player_update + 0x14, prj->currentPosition() + (hits.Normalize() * 0.97f), Vector);
SendProjectileUpdate(local_player, player_update);
auto movpos = MoveTowards(current_position, target_bone, 0.97f);
Ray ray(prj->currentPosition(), movpos);
ht->set_attack_ray(ray);
ht->set_hit_transform(bonetrans);
ht->set_hit_entity(target.player);
ht->set_hit_point(InverseTransformPoint(bonetrans, movpos));
ht->set_hit_normal(InverseTransformDirection(bonetrans, movpos));
ht->set_did_hit(true);
prj->DoHit(ht, movpos, ht->HitNormalWorld());
}
if (get_time() - i->launchTime() < i->traveledTime() + 0.03125f) {
break;
}
}
}
Последнее редактирование: