Follow along with the video below to see how to install our site as a web app on your home screen.
Примечание: This feature may not be available in some browsers.
public EntityThrowable(World p_i1777_1_, EntityLivingBase p_i1777_2_)
{
super(p_i1777_1_);
this.thrower = p_i1777_2_;
this.setSize(0.25F, 0.25F);
this.setLocationAndAngles(p_i1777_2_.posX, p_i1777_2_.posY + (double)p_i1777_2_.getEyeHeight(), p_i1777_2_.posZ, p_i1777_2_.rotationYaw, p_i1777_2_.rotationPitch);
this.posX -= (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F);
this.posY -= 0.10000000149011612D;
this.posZ -= (double)(MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F);
this.setPosition(this.posX, this.posY, this.posZ);
this.yOffset = 0.0F;
float f = 0.4F;
this.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * f);
this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * f);
this.motionY = (double)(-MathHelper.sin((this.rotationPitch + this.func_70183_g()) / 180.0F * (float)Math.PI) * f);
this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, this.func_70182_d(), 1.0F);
}
for(int i=0;i<5;++i){
int baseAngle=45;
rotationYaw+=(i*baseAngle);
}
Как?Develance написал(а):спауни три энтити и указывай каждой ротейт
Vec3 movingobjectposition = player.getLookVec();
EntityBullet bullet = (EntityBullet) new EntityFireball(world, player);
bullet.setPosition(bullet.posX, bullet.posY, bullet.posZ);
bullet.bulletMotionX = movingobjectposition.xCoord;
bullet.bulletMotionY = movingobjectposition.yCoord;
bullet.bulletMotionZ = movingobjectposition.zCoord;
bullet.damage = 5;
bullet.speed = 4;
bullet.rotationyaw = значение;
world.spawnEntityInWorld(bullet);
//сохраяем текущий rotataionYaw игрока
player.rotationYaw = yourYaw; //сам поймёшь
Vec3 movingobjectposition = player.getLookVec(); //преобразует yaw pitch roll в единичный вектор (направление)
EntityBullet bullet = (EntityBullet) new EntityFireball(world, player);
bullet.setPosition(bullet.posX, bullet.posY, bullet.posZ);
bullet.bulletMotionX = movingobjectposition.xCoord;
bullet.bulletMotionY = movingobjectposition.yCoord;
bullet.bulletMotionZ = movingobjectposition.zCoord;
bullet.damage = 5;
bullet.speed = 4;
world.spawnEntityInWorld(bullet);
//верни player.rotationYaw сохранённое значение, чтобы не поломать ничего
Спасибо большое!Oldestkon написал(а):Ты у пули-то нахрена меняешь? motion задаётся исходя из направления взгляда переданной сущности, у неё и меняй.
Код://сохраяем текущий rotataionYaw игрока player.rotationYaw = yourYaw; //сам поймёшь Vec3 movingobjectposition = player.getLookVec(); //преобразует yaw pitch roll в единичный вектор (направление) EntityBullet bullet = (EntityBullet) new EntityFireball(world, player); bullet.setPosition(bullet.posX, bullet.posY, bullet.posZ); bullet.bulletMotionX = movingobjectposition.xCoord; bullet.bulletMotionY = movingobjectposition.yCoord; bullet.bulletMotionZ = movingobjectposition.zCoord; bullet.damage = 5; bullet.speed = 4; world.spawnEntityInWorld(bullet); //верни player.rotationYaw сохранённое значение, чтобы не поломать ничего