// Methods
 public void Unapply(EditorObject obj)
 {
     CoordinateSystem system = CoordinateSystem.FromAngles(obj.Angles);
     AABB localBounds = obj.LocalBounds;
     Vec3 vec = (Vec3)((localBounds.max + localBounds.min) * 0.5f);
     Vec3 vec2 = (Vec3)(localBounds.Length * 0.5f);
     this.position -= (Vec3)((obj.Position + (vec.X * system.axisX)) + (vec.Y * system.axisY));
     this.position = system.ConvertFromWorld(this.position);
     this.normal = system.ConvertFromWorld(this.normal);
     this.normalUp = system.ConvertFromWorld(this.normalUp);
     this.position.X /= vec2.X;
     this.position.Y /= vec2.Y;
     if (this.position.X > 1f)
     {
         this.position.X = 1f;
     }
     else if (this.position.X < -1f)
     {
         this.position.X = -1f;
     }
     if (this.position.Y > 1f)
     {
         this.position.Y = 1f;
     }
     else if (this.position.Y < -1f)
     {
         this.position.Y = -1f;
     }
     if (this.position.Z > 1f)
     {
         this.position.Z = 1f;
     }
     else if (this.position.Z < -1f)
     {
         this.position.Z = -1f;
     }
     this.normal.Z = 0f;
     this.normalUp = new Vec3(0f, 0f, 1f);
 }
Esempio n. 2
0
 static EditorObject()
 {
     Null = new EditorObject(IntPtr.Zero);
 }
 public void ToggleObject(EditorObject obj)
 {
     FCE_ObjectSelection_ToggleObject(this.m_selPtr, obj.Pointer);
 }
 static EditorObjectSelection()
 {
     Null = new EditorObject(IntPtr.Zero);
 }
 public int IndexOf(EditorObject obj)
 {
     for (int i = 0; i < this.Count; i++)
     {
     EditorObject obj2 = this[i];
     if (obj2.Pointer == obj.Pointer)
     {
         return i;
     }
     }
     return -1;
 }
 public bool Contains(EditorObject obj)
 {
     return (this.IndexOf(obj) != -1);
 }
 public void AddObject(EditorObject obj)
 {
     FCE_ObjectSelection_Add(this.m_selPtr, obj.Pointer);
 }
Esempio n. 8
0
 public static bool RayCastPhysics(Vec3 raySrc, Vec3 rayDir, EditorObject ignore, out Vec3 hitPos, out float hitDist, out Vec3 hitNormal)
 {
     return FCE_Editor_RayCastPhysics(raySrc.X, raySrc.Y, raySrc.Z, rayDir.X, rayDir.Y, rayDir.Z, ignore.Pointer, out hitPos.X, out hitPos.Y, out hitPos.Z, out hitDist, out hitNormal.X, out hitNormal.Y, out hitNormal.Z);
 }
Esempio n. 9
0
 public static bool RayCastPhysics(Vec3 raySrc, Vec3 rayDir, EditorObject ignore, out Vec3 hitPos, out float hitDist)
 {
     Vec3 vec;
     return RayCastPhysics(raySrc, rayDir, ignore, out hitPos, out hitDist, out vec);
 }
Esempio n. 10
0
 public static void Focus(EditorObject obj)
 {
     if (obj.IsValid)
     {
         AABB worldBounds = obj.WorldBounds;
         Vec3 center = worldBounds.Center;
         worldBounds -= center;
         Vec3 vec2 = (Vec3)(worldBounds.Length * 0.5f);
         Vec3 vec3 = -(FrontVector);
         Vec3 vec4 = vec3 * vec2;
         Position = center + ((Vec3)((vec3 * vec4.Length) * 4f));
     }
 }