1
This commit is contained in:
parent
db5d455adc
commit
b920543c70
@ -64,6 +64,7 @@ static void CalcGunMuzzlePosition(Creature* c,
|
||||
int bulletIdx,
|
||||
int bulletNum)
|
||||
{
|
||||
bool is_player = c->IsPlayer();
|
||||
if (c->GetHeroMeta()->id() == 60100) {
|
||||
int i = 0;
|
||||
}
|
||||
@ -143,7 +144,7 @@ static void CalcGunMuzzlePosition(Creature* c,
|
||||
auto pos = weapon_meta->_gun_muzzle_positions.at(weapon_lv - 1);
|
||||
gun_muzzle_position +=
|
||||
glm::vec4(
|
||||
-std::get<0>(*pos.get()),
|
||||
std::get<0>(*pos.get()),
|
||||
std::get<1>(*pos.get()),
|
||||
std::get<2>(*pos.get()),
|
||||
0
|
||||
@ -384,6 +385,11 @@ void InternalShot(Creature* c,
|
||||
long long weapon_uniid,
|
||||
int trace_target_uniid)
|
||||
{
|
||||
#if 0
|
||||
if (c->IsPlayer()) {
|
||||
c->SetAttackDir(GlmHelper::UP);
|
||||
}
|
||||
#endif
|
||||
if (weapon_meta->_inventory_slot() == IS_TRAP ||
|
||||
weapon_meta->_inventory_slot() == IS_MINE) {
|
||||
ProcMissile(c, weapon_meta, bullet_meta, skill_meta, fly_distance, weapon_uniid, trace_target_uniid);
|
||||
@ -496,19 +502,21 @@ void InternalShot(Creature* c,
|
||||
{
|
||||
bool is_player = c->IsPlayer();
|
||||
bool is_car = c->IsCar();
|
||||
float bullet_born_angle = GlmHelper::CalcAngle(c->GetAttackDir(), GlmHelper::RIGHT);
|
||||
if (c->GetAttackDir().z > 0.00001f) {
|
||||
float bullet_born_angle = GlmHelper::CalcAngle(c->GetAttackDir(), GlmHelper::UP);
|
||||
//if (c->GetAttackDir().z > 0.00001f) {
|
||||
if (c->GetAttackDir().x < 0.00001f) {
|
||||
bullet_born_angle = -bullet_born_angle;
|
||||
}
|
||||
float old_bullet_born_angle = bullet_born_angle;
|
||||
//GlmHelper::RotateY(bullet_born_offset, bullet_born_angle);
|
||||
|
||||
auto transform = glm::rotate(hero_transform,
|
||||
bullet_born_angle * A8_PI,
|
||||
//bullet_born_angle * A8_PI,
|
||||
glm::radians(bullet_born_angle * 180.0f),
|
||||
glm::vec3(0.0, 1.0, 0.0));
|
||||
glm::vec4 gun_muzzle_position(0.0, 0.0, 0.0, 0.0);
|
||||
CalcGunMuzzlePosition(c, weapon_lv, weapon_meta, shot_animi, gun_muzzle_position, bulletIdx, bulletNum);
|
||||
#ifdef MYDEBUG
|
||||
#ifdef MYDEBUG0
|
||||
gun_muzzle_position +=
|
||||
glm::vec4(
|
||||
bullet_born_offset.x / 10.0f,
|
||||
@ -518,7 +526,8 @@ void InternalShot(Creature* c,
|
||||
);
|
||||
#endif
|
||||
glm::vec4 v = transform * gun_muzzle_position;
|
||||
bullet_born_offset = glm::vec3(v.z *10*1, v.y, v.x*10*-1);
|
||||
//bullet_born_offset = glm::vec3(v.z *10*1, v.y, v.x*10*-1);
|
||||
bullet_born_offset = glm::vec3(v.x *10*1, v.y, v.z*10*1);
|
||||
bullet_born_pos = c->GetPos().ToGlmVec3() + bullet_born_offset;
|
||||
if (c->IsPlayer() || c->IsCar()) {
|
||||
#ifdef MYDEBUG
|
||||
|
Loading…
x
Reference in New Issue
Block a user