using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VisimBox.Physics;
using VisimBox.Scene;
using VisiMath.Geometry;
using VisiMath;
using VisimBox.Renderer;
using VisimBox.Renderer.RenderObjects;

namespace EarthAttacks
{
    public class PhysSphere : RigidBody
    {

        public PhysSphere(Node owner, Sphere sph, Mesh sphmesh, IRenderMaterial mat, Vector3 pos, Vector3 rot, float mass) : base(owner)
        {
            AutoRegister = false;
            _standardGravity = false;
            CanSleep = false;
            AngularDampingType = VisimBox.Physics.DampingType.None;
            PhysicalBody = sph;
            InvertedMass = 1.0f / mass;
            InertiaTensor = Matrix3.CreateInertiaSphere(sph.Radius, mass);
            Material = new PhysMaterial();

            _angularVelocity = rot;

            Trans.Move(ref pos);

            var rn = new NodeMesh(sphmesh, mat);
            rn.BoundingObject = sph;

            AddNode(rn, "renderobject");        
        }

    }
}
