Jump to content

How do I get my render model to rotate in a circle? (the infos in here)


Recommended Posts

Posted

I've been messing around with projectiles for months now and I still don't know how to get the render model to spin around in a circle.

 

Can someone teach me, help me, assist me, or something?

 

I'm clueless how to do this... I just need some help and a direction to go in.

 

Like a thrown entity that spins around horizontally when it flies in the air... not while its in your hand or anything.

I can make the entity but I don't know what to put in my render to make it spin....

Posted

Spin as in around the center? Or as in orbit?

 

spin as in around the center and/or from its original face centered.

Like if a snowball could twirl fast enough it looked 3d or something as an example.

Posted

For models, use GlStateManager.rotate(angle, x, y, z)

 

For a dynamic angle between 0 & 360 degrees, I usually use (System.currentTimeMillis() / 40) % 360

 

alright I was able to find this again... I have been here I had just forgotten....

Still unable to get it to spin though.

 

this is what I have that makes it look straight:

GlStateManager.rotate(entity.rotationYaw, 1, 80, 1);

 

I can do pitch aswell that way. The thing is, when the entity is thrown it sticks in that rotation and flies that way...

It doesn't circulate.

Posted

For models, use GlStateManager.rotate(angle, x, y, z)

 

For a dynamic angle between 0 & 360 degrees, I usually use (System.currentTimeMillis() / 40) % 360

 

alright I was able to find this again... I have been here I had just forgotten....

Still unable to get it to spin though.

 

this is what I have that makes it look straight:

GlStateManager.rotate(entity.rotationYaw, 1, 80, 1);

 

I can do pitch aswell that way. The thing is, when the entity is thrown it sticks in that rotation and flies that way...

It doesn't circulate.

First and foremost: You are rotating it in all axii.

To only rotate the yaw (y-axis rotation) use [angle, 0,1,0] as the variables.

 

This is also only done client-side. What is the entity's rotation clientside? Does it ever change?

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

Posted

The only time that anything is rotated is either in the item json model or the render.

 

The thing is though I can set the angle. It results in a set rotation.

 

Do I need to multiply a rotation times a rotation somehow or something to get it to spin?

Going down a line and doing a different rotation alongside the original results in a new set rotation the entity flies in. It does not spin.

Posted

Oh, I mean- please post your Entity class and your Entity Renderer class.

 

-TGG

 

I'll go with these examples:

entity_orb:

 

package exampled.modinfo.entity;

import java.util.List;
import java.util.UUID;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public abstract class EntityOrb extends Entity implements IProjectile
{
    private int xTile;
    private int yTile;
    private int zTile;
    private Block inTile;
    protected boolean inGround;
    public int throwableShake;
    private EntityLivingBase thrower;
    private String throwerName;
    private int ticksInGround;
    private int ticksInAir;
    public Entity field_184539_c;
    private int field_184540_av;

    public EntityOrb(World worldIn)
    {
        super(worldIn);
        this.xTile = -1;
        this.yTile = -1;
        this.zTile = -1;
        this.setSize(0.41F, 0.41F);
    }
    public EntityOrb(World worldIn, double x, double y, double z)
    {
        this(worldIn);
        this.setPosition(x, y, z);
    }
    public EntityOrb(World worldIn, EntityLivingBase throwerIn)
    {
        this(worldIn, throwerIn.posX, throwerIn.posY + (double)throwerIn.getEyeHeight() - 0.10000000149011612D, throwerIn.posZ);
        this.thrower = throwerIn;
    }
    public boolean canRenderOnFire()
    {
    	return false;
    }
    protected void entityInit()
    {
    }
    @SideOnly(Side.CLIENT)
    public boolean isInRangeToRenderDist(double distance)
    {
        double d0 = this.getEntityBoundingBox().getAverageEdgeLength() * 4.0D;
        if (Double.isNaN(d0))
        {
            d0 = 4.0D;
        }
        d0 = d0 * 64.0D;
        return distance < d0 * d0;
    }
    public void func_184538_a(Entity p_184538_1_, float p_184538_2_, float p_184538_3_, float p_184538_4_, float p_184538_5_, float p_184538_6_)
    {
        float f = -MathHelper.sin(p_184538_3_ * 0.017453292F) * MathHelper.cos(p_184538_2_ * 0.017453292F);
        float f1 = -MathHelper.sin((p_184538_2_ + p_184538_4_) * 0.017453292F);
        float f2 = MathHelper.cos(p_184538_3_ * 0.017453292F) * MathHelper.cos(p_184538_2_ * 0.017453292F);
        this.setThrowableHeading((double)f, (double)f1, (double)f2, p_184538_5_, p_184538_6_);
        this.motionX += p_184538_1_.motionX;
        this.motionZ += p_184538_1_.motionZ;
        if (!p_184538_1_.onGround)
        {
            this.motionY += p_184538_1_.motionY;
        }
    }
    public void setThrowableHeading(double x, double y, double z, float velocity, float inaccuracy)
    {
        float f = MathHelper.sqrt_double(x * x + y * y + z * z);
        x = x / (double)f;
        y = y / (double)f;
        z = z / (double)f;
        x = x + this.rand.nextGaussian() * 0.0D * (double)inaccuracy;
        y = y + this.rand.nextGaussian() * 0.0D * (double)inaccuracy;
        z = z + this.rand.nextGaussian() * 0.0D * (double)inaccuracy;
        x = x * (double)velocity;
        y = y * (double)velocity;
        z = z * (double)velocity;
        this.motionX = x;
        this.motionY = y;
        this.motionZ = z;
        float f1 = MathHelper.sqrt_double(x * x + z * z);
        this.prevRotationYaw = this.rotationYaw = (float)(MathHelper.atan2(x, z) * (180D / Math.PI));
        this.prevRotationPitch = this.rotationPitch = (float)(MathHelper.atan2(y, (double)f1) * (180D / Math.PI));
        this.ticksInGround = 0;
    }
    @SideOnly(Side.CLIENT)
    public void setVelocity(double x, double y, double z)
    {
        this.motionX = x;
        this.motionY = y;
        this.motionZ = z;
        if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F)
        {
            float f = MathHelper.sqrt_double(x * x + z * z);
            this.prevRotationYaw = this.rotationYaw = (float)(MathHelper.atan2(x, z) * (180D / Math.PI));
            this.prevRotationPitch = this.rotationPitch = (float)(MathHelper.atan2(y, (double)f) * (180D / Math.PI));
        }
    }
    public void onUpdate()
    {
        this.lastTickPosX = this.posX;
        this.lastTickPosY = this.posY;
        this.lastTickPosZ = this.posZ;
        super.onUpdate();
        if (this.throwableShake > 0)
        {
            --this.throwableShake;
        }
        if (this.inGround)
        {
            if (this.worldObj.getBlockState(new BlockPos(this.xTile, this.yTile, this.zTile)).getBlock() == this.inTile)
            {
                ++this.ticksInGround;
                if (this.ticksInGround == 1200)
                {
                    this.setDead();
                }
                return;
            }
            this.inGround = false;
            this.motionX *= (double)(this.rand.nextFloat() * 0.2F);
            this.motionY *= (double)(this.rand.nextFloat() * 0.2F);
            this.motionZ *= (double)(this.rand.nextFloat() * 0.2F);
            this.ticksInGround = 0;
            this.ticksInAir = 0;
        }
        else
        {
            ++this.ticksInAir;
        }
        Vec3d vec3d = new Vec3d(this.posX, this.posY, this.posZ);
        Vec3d vec3d1 = new Vec3d(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
        RayTraceResult raytraceresult = this.worldObj.rayTraceBlocks(vec3d, vec3d1);
        vec3d = new Vec3d(this.posX, this.posY, this.posZ);
        vec3d1 = new Vec3d(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
        if (raytraceresult != null)
        {
            vec3d1 = new Vec3d(raytraceresult.hitVec.xCoord, raytraceresult.hitVec.yCoord, raytraceresult.hitVec.zCoord);
        }
        Entity entity = null;
        List<Entity> list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().addCoord(this.motionX, this.motionY, this.motionZ).expandXyz(1.0D));
        double d0 = 0.0D;
        boolean flag = false;
        for (int i = 0; i < list.size(); ++i)
        {
            Entity entity1 = (Entity)list.get(i);
            if (entity1.canBeCollidedWith())
            {
                if (entity1 == this.field_184539_c)
                {
                    flag = true;
                }
                else if (this.ticksExisted < 2 && this.field_184539_c == null)
                {
                    this.field_184539_c = entity1;
                    flag = true;
                }
                else
                {
                    flag = false;
                    AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().expandXyz(0.30000001192092896D);
                    RayTraceResult raytraceresult1 = axisalignedbb.calculateIntercept(vec3d, vec3d1);
                    if (raytraceresult1 != null)
                    {
                        double d1 = vec3d.squareDistanceTo(raytraceresult1.hitVec);

                        if (d1 < d0 || d0 == 0.0D)
                        {
                            entity = entity1;
                            d0 = d1;
                        }
                    }
                }
            }
        }
        if (this.field_184539_c != null)
        {
            if (flag)
            {
                this.field_184540_av = 2;
            }
            else if (this.field_184540_av-- <= 0)
            {
                this.field_184539_c = null;
            }
        }
        if (entity != null)
        {
            raytraceresult = new RayTraceResult(entity);
        }
        if (raytraceresult != null)
        {
            if (raytraceresult.typeOfHit == RayTraceResult.Type.BLOCK && this.worldObj.getBlockState(raytraceresult.getBlockPos()).getBlock() == Blocks.PORTAL)
            {
                this.setPortal(raytraceresult.getBlockPos());
            }
            else
            {
                this.onImpact(raytraceresult);
            }
        }
        this.posX += this.motionX;
        this.posY += this.motionY;
        this.posZ += this.motionZ;
        float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
        this.rotationYaw = (float)(MathHelper.atan2(this.motionX, this.motionZ) * (180D / Math.PI));
        for (this.rotationPitch = (float)(MathHelper.atan2(this.motionY, (double)f) * (180D / Math.PI)); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F)
        {
            ;
        }
        while (this.rotationPitch - this.prevRotationPitch >= 180.0F)
        {
            this.prevRotationPitch += 360.0F;
        }
        while (this.rotationYaw - this.prevRotationYaw < -180.0F)
        {
            this.prevRotationYaw -= 360.0F;
        }

        while (this.rotationYaw - this.prevRotationYaw >= 180.0F)
        {
            this.prevRotationYaw += 360.0F;
        }
        this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F;
        this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F;
        float f1 = 0.99F;
        float f2 = this.getGravityVelocity();
        if (this.isInWater())
        {
            for (int j = 0; j < 4; ++j)
            {
                float f3 = 0.0F;
                this.worldObj.spawnParticle(EnumParticleTypes.WATER_BUBBLE, posX + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) / 2, posY + (worldObj.rand.nextFloat() / -2 - worldObj.rand.nextFloat()) / -1, posZ + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) / 2, 0, 0, 0);
            }
            f1 = 0.8F;
        }
        this.motionX *= (double)f1;
        this.motionY *= (double)f1;
        this.motionZ *= (double)f1;
        this.motionY -= (double)f2;
        this.setPosition(this.posX, this.posY, this.posZ);
    }
    protected float getGravityVelocity()
    {
        return 0.03F;
    }
    protected abstract void onImpact(RayTraceResult result);
    public void writeEntityToNBT(NBTTagCompound tagCompound)
    {
        tagCompound.setInteger("xTile", this.xTile);
        tagCompound.setInteger("yTile", this.yTile);
        tagCompound.setInteger("zTile", this.zTile);
        ResourceLocation resourcelocation = (ResourceLocation)Block.REGISTRY.getNameForObject(this.inTile);
        tagCompound.setString("inTile", resourcelocation == null ? "" : resourcelocation.toString());
        tagCompound.setByte("shake", (byte)this.throwableShake);
        tagCompound.setByte("inGround", (byte)(this.inGround ? 1 : 0));
        if ((this.throwerName == null || this.throwerName.isEmpty()) && this.thrower instanceof EntityPlayer)
        {
            this.throwerName = this.thrower.getName();
        }
        tagCompound.setString("ownerName", this.throwerName == null ? "" : this.throwerName);
    }
    public void readEntityFromNBT(NBTTagCompound tagCompund)
    {
        this.xTile = tagCompund.getInteger("xTile");
        this.yTile = tagCompund.getInteger("yTile");
        this.zTile = tagCompund.getInteger("zTile");
        if (tagCompund.hasKey("inTile", )
        {
            this.inTile = Block.getBlockFromName(tagCompund.getString("inTile"));
        }
        else
        {
            this.inTile = Block.getBlockById(tagCompund.getByte("inTile") & 255);
        }
        this.throwableShake = tagCompund.getByte("shake") & 255;
        this.inGround = tagCompund.getByte("inGround") == 1;
        this.thrower = null;
        this.throwerName = tagCompund.getString("ownerName");
        if (this.throwerName != null && this.throwerName.isEmpty())
        {
            this.throwerName = null;
        }
        this.thrower = this.getThrower();
    }
    public EntityLivingBase getThrower()
    {
        if (this.thrower == null && this.throwerName != null && !this.throwerName.isEmpty())
        {
            this.thrower = this.worldObj.getPlayerEntityByName(this.throwerName);

            if (this.thrower == null && this.worldObj instanceof WorldServer)
            {
                try
                {
                    Entity entity = ((WorldServer)this.worldObj).getEntityFromUuid(UUID.fromString(this.throwerName));
                    if (entity instanceof EntityLivingBase)
                    {
                        this.thrower = (EntityLivingBase)entity;
                    }
                }
                catch (Throwable var2)
                {
                    this.thrower = null;
                }
            }
        }     
        return this.thrower;
    }
}

 

 

entity_sphere extends entity_orb for it to be completely customizable:

 

package exampled.modinfo.entity;

import net.minecraft.block.Block;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.SoundEvents;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;

public class EntitySphere extends EntityOrb
{
public EntitySphere(World worldIn)
    {
        super(worldIn);
    } 
    public EntitySphere(World worldIn, EntityLivingBase throwerIn)
    {
        super(worldIn, throwerIn);
    } 
    public void onUpdate()
    {
    	super.onUpdate();
    	this.worldObj.spawnParticle(EnumParticleTypes.BLOCK_CRACK, posX + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) / 2, posY + (worldObj.rand.nextFloat() / -2 - worldObj.rand.nextFloat()) / -1.3, posZ + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) / 2, 0, 0, 0,  new int[] {Block.getIdFromBlock(Blocks.PORTAL)});
    }
    public EntitySphere(World worldIn, double x, double y, double z)
    {
        super(worldIn, x, y, z);
    }
    
    protected void onImpact(RayTraceResult result)
    {
        if (result.entityHit != null)
        {
            int i = 0;
            if (result.entityHit instanceof EntityLivingBase)
            {
                i = 4;
            }
            result.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), (float)i);
            worldObj.playSound((EntityPlayer)null, posX, posY, posZ, SoundEvents.BLOCK_GRASS_BREAK, SoundCategory.NEUTRAL, 0.8F, 1.5F / (worldObj.rand.nextFloat() * 0.4F + 0.8F));
        }
        for (int j = 0; j < 8; ++j)
        {
            this.worldObj.spawnParticle(EnumParticleTypes.BLOCK_CRACK, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D, new int[] {Block.getIdFromBlock(Blocks.DIRT)});
        }
        if (!this.worldObj.isRemote)
        {
            this.setDead();
            worldObj.playSound((EntityPlayer)null, posX, posY, posZ, SoundEvents.BLOCK_GRASS_BREAK, SoundCategory.NEUTRAL, 0.7F, 1.5F / (worldObj.rand.nextFloat() * 0.4F + 0.8F));
        }
    }
}

 

 

here is its render:

 

package exampled.modinfo.entity.render;

import exampled.modinfo.entity.EntitySphere;
import exampled.modinfo.entity.model.ModelSphere;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;


@SideOnly(Side.CLIENT)
public class RenderSphere extends Render
{
    protected ModelSphere model;
    
    public RenderSphere(RenderManager renderManager)
    {
        super(renderManager);
        this.model = new ModelSphere();
    }
    
    public void doRender(EntitySphere entity, double x, double y, double z, float f, float partialTicks)
    {
        GlStateManager.pushMatrix();
        this.bindEntityTexture(entity);
        GlStateManager.translate(x, y - 0.4734, z);
        GlStateManager.rotate(entity.rotationYaw, 1, 80, 1);
        
        if(model.shouldBeTransparent())
        {
            GlStateManager.enableNormalize();
            GlStateManager.enableBlend();
            GlStateManager.blendFunc(770, 771);
            model.render(entity, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
            GlStateManager.disableBlend();
            GlStateManager.disableNormalize();
        }
        else
            model.render(entity, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
        
        GlStateManager.popMatrix();
        super.doRender(entity, x, y, z, f, partialTicks);
    }
    
    protected ResourceLocation getTexture(EntitySphere entity)
    {
        return model.getTexture();
    }
    
    protected ResourceLocation getEntityTexture(Entity entity)
    {
        return this.getTexture((EntitySphere)entity);
    }
    public void doRender(Entity entity, double x, double y, double z, float f, float partialTicks)
    {
        this.doRender((EntitySphere)entity, x, y, z, f, partialTicks);
    }
}

 

 

And here is the models for both orb and sphere:

orb:

 

package exampled.modinfo.entity.model;

import net.minecraft.client.model.ModelBase;
import net.minecraft.util.ResourceLocation;

public abstract class ModelOrb extends ModelBase
{
    public abstract ResourceLocation getTexture();

public abstract boolean shouldBeTransparent();
}

 

 

sphere:

 

package exampled.modinfo.entity.model;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;

public class ModelSphere extends ModelOrb
{
public ResourceLocation getTexture()
{
	return new ResourceLocation("exampled:textures/entity/sphere.png");
}

public boolean shouldBeTransparent()
{
	return true;
}

    ModelRenderer Shape1;
    ModelRenderer Shape2;
    ModelRenderer Shape3;
    ModelRenderer Shape4;
    ModelRenderer Shape5;
    ModelRenderer Shape6;
    ModelRenderer Shape7;
    ModelRenderer Shape8;
    ModelRenderer Shape9;
    ModelRenderer Shape10;
    ModelRenderer Shape11;
    ModelRenderer Shape12;
    ModelRenderer Shape13;
    ModelRenderer Shape14;
    ModelRenderer Shape15;
    ModelRenderer Shape16;
    ModelRenderer Shape17;
    ModelRenderer Shape18;
    ModelRenderer Shape19;
    ModelRenderer Shape20;
    ModelRenderer Shape21;
    ModelRenderer Shape22;
    ModelRenderer Shape23;
    ModelRenderer Shape24;
    ModelRenderer Shape25;
    ModelRenderer Shape26;
    ModelRenderer Shape27;
    ModelRenderer Shape28;
    ModelRenderer Shape29;
    ModelRenderer Shape30;
    ModelRenderer Shape31;
    ModelRenderer Shape32;
    ModelRenderer Shape33;
    ModelRenderer Shape34;
    ModelRenderer Shape35;
    ModelRenderer Shape36;
    ModelRenderer Shape37;
    ModelRenderer Shape38;
    ModelRenderer Shape39;
    ModelRenderer Shape40;
    ModelRenderer Shape41;
    ModelRenderer Shape42;
    ModelRenderer Shape43;
    ModelRenderer Shape44;
    ModelRenderer Shape45;
    ModelRenderer Shape46;
    ModelRenderer Shape47;
    ModelRenderer Shape48;
    ModelRenderer Shape49;
  
  public ModelSphere()
  {
    textureWidth = 32;
    textureHeight = 512;
    
      Shape1 = new ModelRenderer(this, 0, 0);
      Shape1.addBox(-1F, 0F, 0F, 5, 1, 1);
      Shape1.setRotationPoint(-2F, 22F, 0F);
      Shape1.setTextureSize(32, 512);
      Shape1.mirror = true;
      setRotation(Shape1, 0F, 0F, 0F);
      Shape2 = new ModelRenderer(this, 0, 0);
      Shape2.addBox(0F, 0F, 0F, 1, 1, 2);
      Shape2.setRotationPoint(-1F, 22F, 1F);
      Shape2.setTextureSize(32, 512);
      Shape2.mirror = true;
      setRotation(Shape2, 0F, 0F, 0F);
      Shape3 = new ModelRenderer(this, 0, 0);
      Shape3.addBox(0F, 0F, 0F, 1, 1, 2);
      Shape3.setRotationPoint(-1F, 22F, -2F);
      Shape3.setTextureSize(32, 512);
      Shape3.mirror = true;
      setRotation(Shape3, 0F, 0F, 0F);
      Shape4 = new ModelRenderer(this, 0, 0);
      Shape4.addBox(0F, 0F, 0F, 1, 1, 1);
      Shape4.setRotationPoint(0F, 22F, 1F);
      Shape4.setTextureSize(32, 512);
      Shape4.mirror = true;
      setRotation(Shape4, 0F, 0F, 0F);
      Shape5 = new ModelRenderer(this, 0, 0);
      Shape5.addBox(0F, 0F, 0F, 1, 1, 1);
      Shape5.setRotationPoint(0F, 22F, -1F);
      Shape5.setTextureSize(32, 512);
      Shape5.mirror = true;
      setRotation(Shape5, 0F, 0F, 0F);
      Shape6 = new ModelRenderer(this, 0, 0);
      Shape6.addBox(0F, 0F, 0F, 1, 1, 1);
      Shape6.setRotationPoint(-2F, 22F, 1F);
      Shape6.setTextureSize(32, 512);
      Shape6.mirror = true;
      setRotation(Shape6, 0F, 0F, 0F);
      Shape7 = new ModelRenderer(this, 0, 0);
      Shape7.addBox(0F, 0F, -1F, 1, 1, 1);
      Shape7.setRotationPoint(-2F, 22F, 0F);
      Shape7.setTextureSize(32, 512);
      Shape7.mirror = true;
      setRotation(Shape7, 0F, 0F, 0F);
      Shape8 = new ModelRenderer(this, 0, 0);
      Shape8.addBox(0F, 0F, 0F, 5, 1, 1);
      Shape8.setRotationPoint(-3F, 10F, 0F);
      Shape8.setTextureSize(32, 512);
      Shape8.mirror = true;
      setRotation(Shape8, 0F, 0F, 0F);
      Shape9 = new ModelRenderer(this, 0, 0);
      Shape9.addBox(0F, 0F, 0F, 1, 1, 2);
      Shape9.setRotationPoint(-1F, 10F, 1F);
      Shape9.setTextureSize(32, 512);
      Shape9.mirror = true;
      setRotation(Shape9, 0F, 0F, 0F);
      Shape10 = new ModelRenderer(this, 0, 0);
      Shape10.addBox(0F, 0F, 0F, 1, 1, 2);
      Shape10.setRotationPoint(-1F, 10F, -2F);
      Shape10.setTextureSize(32, 512);
      Shape10.mirror = true;
      setRotation(Shape10, 0F, 0F, 0F);
      Shape11 = new ModelRenderer(this, 0, 0);
      Shape11.addBox(0F, 0F, 0F, 1, 1, 1);
      Shape11.setRotationPoint(0F, 10F, -1F);
      Shape11.setTextureSize(32, 512);
      Shape11.mirror = true;
      setRotation(Shape11, 0F, 0F, 0F);
      Shape12 = new ModelRenderer(this, 0, 0);
      Shape12.addBox(0F, 0F, 0F, 1, 1, 1);
      Shape12.setRotationPoint(0F, 10F, 1F);
      Shape12.setTextureSize(32, 512);
      Shape12.mirror = true;
      setRotation(Shape12, 0F, 0F, 0F);
      Shape13 = new ModelRenderer(this, 0, 0);
      Shape13.addBox(0F, 0F, 0F, 1, 1, 1);
      Shape13.setRotationPoint(-2F, 10F, 1F);
      Shape13.setTextureSize(32, 512);
      Shape13.mirror = true;
      setRotation(Shape13, 0F, 0F, 0F);
      Shape14 = new ModelRenderer(this, 0, 0);
      Shape14.addBox(0F, 0F, 0F, 1, 1, 1);
      Shape14.setRotationPoint(-2F, 10F, -1F);
      Shape14.setTextureSize(32, 512);
      Shape14.mirror = true;
      setRotation(Shape14, 0F, 0F, 0F);
      Shape15 = new ModelRenderer(this, 0, 0);
      Shape15.addBox(0F, 0F, 0F, 1, 1, 5);
      Shape15.setRotationPoint(5F, 16F, -2F);
      Shape15.setTextureSize(32, 512);
      Shape15.mirror = true;
      setRotation(Shape15, 0F, 0F, 0F);
      Shape16 = new ModelRenderer(this, 0, 0);
      Shape16.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape16.setRotationPoint(5F, 14F, 0F);
      Shape16.setTextureSize(32, 512);
      Shape16.mirror = true;
      setRotation(Shape16, 0F, 0F, 0F);
      Shape17 = new ModelRenderer(this, 0, 0);
      Shape17.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape17.setRotationPoint(5F, 17F, 0F);
      Shape17.setTextureSize(32, 512);
      Shape17.mirror = true;
      setRotation(Shape17, 0F, 0F, 0F);
      Shape18 = new ModelRenderer(this, 0, 0);
      Shape18.addBox(0F, 0F, 0F, 1, 1, 1);
      Shape18.setRotationPoint(5F, 15F, 1F);
      Shape18.setTextureSize(32, 512);
      Shape18.mirror = true;
      setRotation(Shape18, 0F, 0F, 0F);
      Shape19 = new ModelRenderer(this, 0, 0);
      Shape19.addBox(0F, 0F, 0F, 1, 1, 1);
      Shape19.setRotationPoint(5F, 15F, -1F);
      Shape19.setTextureSize(32, 512);
      Shape19.mirror = true;
      setRotation(Shape19, 0F, 0F, 0F);
      Shape20 = new ModelRenderer(this, 0, 0);
      Shape20.addBox(0F, 0F, 0F, 1, 1, 1);
      Shape20.setRotationPoint(5F, 17F, 1F);
      Shape20.setTextureSize(32, 512);
      Shape20.mirror = true;
      setRotation(Shape20, 0F, 0F, 0F);
      Shape21 = new ModelRenderer(this, 0, 0);
      Shape21.addBox(0F, 0F, 0F, 1, 1, 1);
      Shape21.setRotationPoint(5F, 17F, -1F);
      Shape21.setTextureSize(32, 512);
      Shape21.mirror = true;
      setRotation(Shape21, 0F, 0F, 0F);
      Shape22 = new ModelRenderer(this, 0, 0);
      Shape22.addBox(0F, 0F, 0F, 5, 1, 1);
      Shape22.setRotationPoint(-3F, 16F, -6F);
      Shape22.setTextureSize(32, 512);
      Shape22.mirror = true;
      setRotation(Shape22, 0F, 0F, 0F);
      Shape23 = new ModelRenderer(this, 0, 0);
      Shape23.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape23.setRotationPoint(-1F, 14F, -6F);
      Shape23.setTextureSize(32, 512);
      Shape23.mirror = true;
      setRotation(Shape23, 0F, 0F, 0F);
      Shape24 = new ModelRenderer(this, 0, 0);
      Shape24.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape24.setRotationPoint(-1F, 17F, -6F);
      Shape24.setTextureSize(32, 512);
      Shape24.mirror = true;
      setRotation(Shape24, 0F, 0F, 0F);
      Shape25 = new ModelRenderer(this, 0, 0);
      Shape25.addBox(0F, 0F, 0F, 1, 1, 1);
      Shape25.setRotationPoint(0F, 17F, -6F);
      Shape25.setTextureSize(32, 512);
      Shape25.mirror = true;
      setRotation(Shape25, 0F, 0F, 0F);
      Shape26 = new ModelRenderer(this, 0, 0);
      Shape26.addBox(0F, 0F, 0F, 1, 1, 1);
      Shape26.setRotationPoint(0F, 15F, -6F);
      Shape26.setTextureSize(32, 512);
      Shape26.mirror = true;
      setRotation(Shape26, 0F, 0F, 0F);
      Shape27 = new ModelRenderer(this, 0, 0);
      Shape27.addBox(0F, 0F, 0F, 1, 1, 1);
      Shape27.setRotationPoint(-2F, 15F, -6F);
      Shape27.setTextureSize(32, 512);
      Shape27.mirror = true;
      setRotation(Shape27, 0F, 0F, 0F);
      Shape28 = new ModelRenderer(this, 0, 0);
      Shape28.addBox(0F, 0F, 0F, 1, 1, 1);
      Shape28.setRotationPoint(-2F, 17F, -6F);
      Shape28.setTextureSize(32, 512);
      Shape28.mirror = true;
      setRotation(Shape28, 0F, 0F, 0F);
      Shape29 = new ModelRenderer(this, 0, 0);
      Shape29.addBox(0F, 0F, 0F, 5, 1, 1);
      Shape29.setRotationPoint(-3F, 16F, 6F);
      Shape29.setTextureSize(32, 512);
      Shape29.mirror = true;
      setRotation(Shape29, 0F, 0F, 0F);
      Shape30 = new ModelRenderer(this, 0, 0);
      Shape30.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape30.setRotationPoint(-1F, 14F, 6F);
      Shape30.setTextureSize(32, 512);
      Shape30.mirror = true;
      setRotation(Shape30, 0F, 0F, 0F);
      Shape31 = new ModelRenderer(this, 0, 0);
      Shape31.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape31.setRotationPoint(-1F, 17F, 6F);
      Shape31.setTextureSize(32, 512);
      Shape31.mirror = true;
      setRotation(Shape31, 0F, 0F, 0F);
      Shape32 = new ModelRenderer(this, 0, 0);
      Shape32.addBox(0F, 0F, 0F, 1, 1, 1);
      Shape32.setRotationPoint(0F, 15F, 6F);
      Shape32.setTextureSize(32, 512);
      Shape32.mirror = true;
      setRotation(Shape32, 0F, 0F, 0F);
      Shape33 = new ModelRenderer(this, 0, 0);
      Shape33.addBox(0F, 0F, 0F, 1, 1, 1);
      Shape33.setRotationPoint(-2F, 17F, 6F);
      Shape33.setTextureSize(32, 512);
      Shape33.mirror = true;
      setRotation(Shape33, 0F, 0F, 0F);
      Shape34 = new ModelRenderer(this, 0, 0);
      Shape34.addBox(0F, 0F, 0F, 1, 1, 1);
      Shape34.setRotationPoint(-2F, 15F, 6F);
      Shape34.setTextureSize(32, 512);
      Shape34.mirror = true;
      setRotation(Shape34, 0F, 0F, 0F);
      Shape35 = new ModelRenderer(this, 0, 0);
      Shape35.addBox(0F, 0F, 0F, 1, 1, 1);
      Shape35.setRotationPoint(0F, 17F, 6F);
      Shape35.setTextureSize(32, 512);
      Shape35.mirror = true;
      setRotation(Shape35, 0F, 0F, 0F);
      Shape36 = new ModelRenderer(this, 0, 0);
      Shape36.addBox(0F, 0F, 0F, 1, 1, 5);
      Shape36.setRotationPoint(-7F, 16F, -2F);
      Shape36.setTextureSize(32, 512);
      Shape36.mirror = true;
      setRotation(Shape36, 0F, 0F, 0F);
      Shape37 = new ModelRenderer(this, 0, 0);
      Shape37.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape37.setRotationPoint(-7F, 17F, 0F);
      Shape37.setTextureSize(32, 512);
      Shape37.mirror = true;
      setRotation(Shape37, 0F, 0F, 0F);
      Shape38 = new ModelRenderer(this, 0, 0);
      Shape38.addBox(0F, 0F, 0F, 1, 2, 1);
      Shape38.setRotationPoint(-7F, 14F, 0F);
      Shape38.setTextureSize(32, 512);
      Shape38.mirror = true;
      setRotation(Shape38, 0F, 0F, 0F);
      Shape39 = new ModelRenderer(this, 0, 0);
      Shape39.addBox(0F, 0F, 0F, 1, 1, 1);
      Shape39.setRotationPoint(-7F, 17F, -1F);
      Shape39.setTextureSize(32, 512);
      Shape39.mirror = true;
      setRotation(Shape39, 0F, 0F, 0F);
      Shape40 = new ModelRenderer(this, 0, 0);
      Shape40.addBox(0F, 0F, 0F, 1, 1, 1);
      Shape40.setRotationPoint(-7F, 15F, -1F);
      Shape40.setTextureSize(32, 512);
      Shape40.mirror = true;
      setRotation(Shape40, 0F, 0F, 0F);
      Shape41 = new ModelRenderer(this, 0, 0);
      Shape41.addBox(0F, 0F, 0F, 1, 1, 1);
      Shape41.setRotationPoint(-7F, 17F, 1F);
      Shape41.setTextureSize(32, 512);
      Shape41.mirror = true;
      setRotation(Shape41, 0F, 0F, 0F);
      Shape42 = new ModelRenderer(this, 0, 0);
      Shape42.addBox(0F, 0F, 0F, 1, 1, 1);
      Shape42.setRotationPoint(-7F, 15F, 1F);
      Shape42.setTextureSize(32, 512);
      Shape42.mirror = true;
      setRotation(Shape42, 0F, 0F, 0F);
      Shape43 = new ModelRenderer(this, 0, 0);
      Shape43.addBox(0F, 0F, 0F, 7, 1, 7);
      Shape43.setRotationPoint(-4F, 21F, -3F);
      Shape43.setTextureSize(32, 512);
      Shape43.mirror = true;
      setRotation(Shape43, 0F, 0F, 0F);
      Shape44 = new ModelRenderer(this, 0, 0);
      Shape44.addBox(0F, 0F, 0F, 7, 1, 7);
      Shape44.setRotationPoint(-4F, 11F, -3F);
      Shape44.setTextureSize(32, 512);
      Shape44.mirror = true;
      setRotation(Shape44, 0F, 0F, 0F);
      Shape45 = new ModelRenderer(this, 0, 0);
      Shape45.addBox(0F, 0F, 0F, 1, 7, 7);
      Shape45.setRotationPoint(4F, 13F, -3F);
      Shape45.setTextureSize(32, 512);
      Shape45.mirror = true;
      setRotation(Shape45, 0F, 0F, 0F);
      Shape46 = new ModelRenderer(this, 0, 0);
      Shape46.addBox(0F, 0F, 0F, 1, 7, 7);
      Shape46.setRotationPoint(-6F, 13F, -3F);
      Shape46.setTextureSize(32, 512);
      Shape46.mirror = true;
      setRotation(Shape46, 0F, 0F, 0F);
      Shape47 = new ModelRenderer(this, 0, 0);
      Shape47.addBox(0F, 0F, 0F, 7, 7, 1);
      Shape47.setRotationPoint(-4F, 13F, 5F);
      Shape47.setTextureSize(32, 512);
      Shape47.mirror = true;
      setRotation(Shape47, 0F, 0F, 0F);
      Shape48 = new ModelRenderer(this, 0, 0);
      Shape48.addBox(0F, 0F, 0F, 7, 7, 1);
      Shape48.setRotationPoint(-4F, 13F, -5F);
      Shape48.setTextureSize(32, 512);
      Shape48.mirror = true;
      setRotation(Shape48, 0F, 0F, 0F);
      Shape49 = new ModelRenderer(this, 0, 0);
      Shape49.addBox(0F, 0F, 0F, 9, 9, 9);
      Shape49.setRotationPoint(-5F, 12F, -4F);
      Shape49.setTextureSize(32, 512);
      Shape49.mirror = true;
      setRotation(Shape49, 0F, 0F, 0F);
  }
  
  public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
  {
    super.render(entity, f, f1, f2, f3, f4, f5);
    setRotationAngles(f, f1, f2, f3, f4, f5, entity);
    Shape1.render(f5);
    Shape2.render(f5);
    Shape3.render(f5);
    Shape4.render(f5);
    Shape5.render(f5);
    Shape6.render(f5);
    Shape7.render(f5);
    Shape8.render(f5);
    Shape9.render(f5);
    Shape10.render(f5);
    Shape11.render(f5);
    Shape12.render(f5);
    Shape13.render(f5);
    Shape14.render(f5);
    Shape15.render(f5);
    Shape16.render(f5);
    Shape17.render(f5);
    Shape18.render(f5);
    Shape19.render(f5);
    Shape20.render(f5);
    Shape21.render(f5);
    Shape22.render(f5);
    Shape23.render(f5);
    Shape24.render(f5);
    Shape25.render(f5);
    Shape26.render(f5);
    Shape27.render(f5);
    Shape28.render(f5);
    Shape29.render(f5);
    Shape30.render(f5);
    Shape31.render(f5);
    Shape32.render(f5);
    Shape33.render(f5);
    Shape34.render(f5);
    Shape35.render(f5);
    Shape36.render(f5);
    Shape37.render(f5);
    Shape38.render(f5);
    Shape39.render(f5);
    Shape40.render(f5);
    Shape41.render(f5);
    Shape42.render(f5);
    Shape43.render(f5);
    Shape44.render(f5);
    Shape45.render(f5);
    Shape46.render(f5);
    Shape47.render(f5);
    Shape48.render(f5);
    Shape49.render(f5);
  }
  
  private void setRotation(ModelRenderer model, float x, float y, float z)
  {
    model.rotateAngleX = x;
    model.rotateAngleY = y;
    model.rotateAngleZ = z;
  }
  
  public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
  {
    super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
  }
}

 

Posted

The only time that anything is rotated is either in the item json model or the render.

 

The thing is though I can set the angle. It results in a set rotation.

 

Do I need to multiply a rotation times a rotation somehow or something to get it to spin?

Going down a line and doing a different rotation alongside the original results in a new set rotation the entity flies in. It does not spin.

 

Of course the angle is static, if you never change the value of it. GlStateManager does not rotate the model for you, by the given angle, every who-knows-what-time-units. It only rotates once, by that amount. You need to -continuously- edit the angle to be something between 0-360 degrees.

As mentioned,

(System.currentTimeMillis() / 40) % 360

gives you a value that is always changing (aka creating a rotation) but always fixed between 0-360 degrees.

Could you try using:

GlStateManager.rotate((System.currentTimeMillis() / 40) % 360, 0, 1, 0);

? Does it, or does it not make your model rotate around continuously?

 

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

Posted

The only time that anything is rotated is either in the item json model or the render.

 

The thing is though I can set the angle. It results in a set rotation.

 

Do I need to multiply a rotation times a rotation somehow or something to get it to spin?

Going down a line and doing a different rotation alongside the original results in a new set rotation the entity flies in. It does not spin.

 

Of course the angle is static, if you never change the value of it. GlStateManager does not rotate the model for you, by the given angle, every who-knows-what-time-units. It only rotates once, by that amount. You need to -continuously- edit the angle to be something between 0-360 degrees.

As mentioned,

(System.currentTimeMillis() / 40) % 360

gives you a value that is always changing (aka creating a rotation) but always fixed between 0-360 degrees.

Could you try using:

GlStateManager.rotate((System.currentTimeMillis() / 40) % 360, 0, 1, 0);

? Does it, or does it not make your model rotate around continuously?

 

I did it like so, so when it is thrown it doesn't get thrown lopsided, INDEED IT DOES SPIN!

GlStateManager.rotate(entity.rotationYaw, 1, 80, 1);
GlStateManager.rotate((System.currentTimeMillis() / 40) % 360, 0, 1, 0);

and it spins horizontally just like what I was looking for, but it is a rather slow spin! :D!!!!!!!

I'll be a lvl 30 sorcerer soon enough :D

 

THIS IS SO COOL! :D thanks man! thanks a million. so friggin awesome >.<

Posted

changing this:

GlStateManager.rotate((System.currentTimeMillis() / 40) % 360, 0, 1, 0);

 

to this:

GlStateManager.rotate((System.currentTimeMillis() / 1) % 360, 0, 1, 0);

 

makes it spin extremely fast. (too fast honestly, but still pretty fun :P)

Posted

Yes, that change would indeed make it spin faster.  Because math.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Yes, that change would indeed make it spin faster.  Because math.

 

One of these days I'll grow up to be a smartass too :P

(I'm honestly still rather astonished) beating people up because they have hopes and dreams!!!!

How can you be so mean?

 

<--- you see how my avatar predicted the future? I'm psychic man, mess with me and I'll explode your brain.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.