Ejemplo n.º 1
0
        public override GameObject CreateEntity(Vector3f translation, Vector3f slope)
        {
            int numThingsInCluster = rand.Next(1, 4);
            Node clusterNode = new Node();
            for (int i = 0; i < numThingsInCluster; i++)
            {
                Vector3f clusterLoc;
                clusterLoc = new Vector3f((float)RandomDouble(-3f, 3f), 0, (float)RandomDouble(-3f, 3f));

                Geometry m = (Geometry)model.Clone();

                Vector3f pieceLoc;

                if (i > 0)
                    pieceLoc = clusterLoc.Add(translation);
                else
                    pieceLoc = translation;

            //    pieceLoc.y = this.GetHeight(pieceLoc.x, pieceLoc.z);

                m.SetLocalTranslation(pieceLoc);

                m.SetLocalRotation(new Quaternion().SetFromAxis(Vector3f.UnitY, (float)RandomDouble(0, 359)));
                m.SetLocalScale(new Vector3f((float)this.RandomDouble(1.0, 1.9)));
                clusterNode.AddChild(m);
            }

            return clusterNode;
        }
Ejemplo n.º 2
0
 public void Raycast(Vector3f origin, Vector3f direction, out Vector3f hitPoint)
 {
     Jitter.LinearMath.JVector outNormal;
     RigidBody outBody;
     float outFraction;
     bool hit = world.CollisionSystem.Raycast(new Jitter.LinearMath.JVector(origin.x, origin.y, origin.z),
                                   new Jitter.LinearMath.JVector(direction.x, direction.y, direction.z),
                                   null, out outBody, out outNormal, out outFraction);
     if (hit)
         hitPoint = origin.Add(direction.Multiply(outFraction));
     else
         hitPoint = null;
 }
Ejemplo n.º 3
0
 public override void SetWorldTransformPhysics(Vector3f trans, Quaternion rot, Vector3f scl)
 {
     base.SetWorldTransformPhysics(trans, rot, scl);
     foreach (GameObject gi in children)
         gi.SetWorldTransformPhysics(trans.Add(gi.GetLocalTranslation()), rot.Multiply(gi.GetLocalRotation()), scl.Multiply(gi.GetLocalScale()));
 }