private static extern void Internal_setMaterial(IntPtr thisPtr, RRef <PhysicsMaterial> material);
Exemple #2
0
 /// <summary>
 /// Performs a sweep into the scene using a convex mesh and checks if it has hit anything. This can be significantly more
 /// efficient than other types of cast* calls.
 /// </summary>
 /// <param name="mesh">Mesh to sweep through the scene. Must be convex.</param>
 /// <param name="position">Starting position of the mesh.</param>
 /// <param name="rotation">Orientation of the mesh.</param>
 /// <param name="unitDir">Unit direction towards which to perform the sweep.</param>
 /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.</param>
 /// <param name="max">
 /// Maximum distance at which to perform the query. Hits past this distance will not be detected.
 /// </param>
 /// <returns>True if something was hit, false otherwise.</returns>
 public static bool ConvexCastAny(RRef <PhysicsMesh> mesh, Vector3 position, Quaternion rotation, Vector3 unitDir, ulong layer = 18446744073709551615, float max = 3.40282347E+38f)
 {
     return(Internal_convexCastAny(mesh, ref position, ref rotation, ref unitDir, layer, max));
 }
 private static extern void Internal_setmaterial(IntPtr thisPtr, RRef <Material> value);
 private static extern void Internal_setmesh(IntPtr thisPtr, RRef <Mesh> value);
Exemple #5
0
 /// <summary>Registers a new string table or replaces an old one at the specified id.</summary>
 /// <param name="id">Identifier of the string table.</param>
 /// <param name="table">New string table to assign to the specified identifier.</param>
 public static void SetTable(int id, RRef <StringTable> table)
 {
     Internal_setTable(id, table);
 }
Exemple #6
0
 private static extern void Internal_setSpriteTexture(IntPtr thisPtr, string name, RRef <SpriteTexture> value);
Exemple #7
0
 /// <summary>Creates a new material with the specified shader.</summary>
 public Material(RRef <Shader> shader)
 {
     Internal_create0(this, shader);
 }
Exemple #8
0
 private static extern Collider[] Internal_convexOverlap(RRef <PhysicsMesh> mesh, ref Vector3 position, ref Quaternion rotation, ulong layer);
Exemple #9
0
 private static extern void Internal_setMesh(IntPtr thisPtr, RRef <PhysicsMesh> mesh);
Exemple #10
0
 private static extern void Internal_setShader(IntPtr thisPtr, RRef <Shader> shader);
Exemple #11
0
        /// <summary>
        /// Builds a list of properties that will be animated using float animation curves.
        /// </summary>
        /// <param name="clip">Clip to retrieve the float animation curves from.</param>
        partial void RebuildFloatProperties(RRef <AnimationClip> clip)
        {
            if (clip == null)
            {
                floatProperties = null;
                return;
            }

            AnimationCurves curves = clip.Value.Curves;

            List <FloatCurvePropertyInfo> newFloatProperties = new List <FloatCurvePropertyInfo>();

            for (int i = 0; i < curves.Generic.Length; i++)
            {
                bool isMorphCurve = curves.Generic[i].flags.HasFlag(AnimationCurveFlags.MorphWeight) ||
                                    curves.Generic[i].flags.HasFlag(AnimationCurveFlags.MorphFrame);

                if (isMorphCurve)
                {
                    continue;
                }

                string suffix;
                SerializableProperty property = FindProperty(SceneObject, curves.Generic[i].name, out suffix);
                if (property == null)
                {
                    continue;
                }

                int elementIdx = 0;
                if (!string.IsNullOrEmpty(suffix))
                {
                    PropertySuffixInfo suffixInfo;
                    if (PropertySuffixInfos.TryGetValue(suffix, out suffixInfo))
                    {
                        elementIdx = suffixInfo.elementIdx;
                    }
                }

                Action <float> setter = null;

                Type internalType = property.InternalType;
                switch (property.Type)
                {
                case SerializableProperty.FieldType.Vector2:
                    if (internalType == typeof(Vector2))
                    {
                        setter = f =>
                        {
                            Vector2 value = property.GetValue <Vector2>();
                            value[elementIdx] = f;
                            property.SetValue(value);
                        };
                    }

                    break;

                case SerializableProperty.FieldType.Vector3:
                    if (internalType == typeof(Vector3))
                    {
                        setter = f =>
                        {
                            Vector3 value = property.GetValue <Vector3>();
                            value[elementIdx] = f;
                            property.SetValue(value);
                        };
                    }
                    break;

                case SerializableProperty.FieldType.Vector4:
                    setter = f =>
                    {
                        Vector4 value = property.GetValue <Vector4>();
                        value[elementIdx] = f;
                        property.SetValue(value);
                    };
                    break;

                case SerializableProperty.FieldType.Color:
                    if (internalType == typeof(Color))
                    {
                        setter = f =>
                        {
                            Color value = property.GetValue <Color>();
                            value[elementIdx] = f;
                            property.SetValue(value);
                        };
                    }
                    break;

                case SerializableProperty.FieldType.Bool:
                    setter = f =>
                    {
                        bool value = f > 0.0f;
                        property.SetValue(value);
                    };
                    break;

                case SerializableProperty.FieldType.Int:
                    setter = f =>
                    {
                        int value = (int)f;
                        property.SetValue(value);
                    };
                    break;

                case SerializableProperty.FieldType.Float:
                    setter = f =>
                    {
                        property.SetValue(f);
                    };
                    break;
                }

                if (setter == null)
                {
                    continue;
                }

                FloatCurvePropertyInfo propertyInfo = new FloatCurvePropertyInfo();
                propertyInfo.curveIdx = i;
                propertyInfo.setter   = setter;

                newFloatProperties.Add(propertyInfo);
            }

            floatProperties = newFloatProperties.ToArray();
        }
Exemple #12
0
 private static extern void Internal_setvectorField(IntPtr thisPtr, RRef <VectorField> value);
Exemple #13
0
 private static extern void Internal_setTable(int id, RRef <StringTable> table);
Exemple #14
0
 /// <summary>Checks if the provided convex mesh overlaps any other collider in the scene.</summary>
 /// <param name="mesh">Mesh to check for overlap. Must be convex.</param>
 /// <param name="position">Position of the mesh.</param>
 /// <param name="rotation">Orientation of the mesh.</param>
 /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.</param>
 /// <returns>True if there is overlap with another object, false otherwise.</returns>
 public static bool ConvexOverlapAny(RRef <PhysicsMesh> mesh, Vector3 position, Quaternion rotation, ulong layer = 18446744073709551615)
 {
     return(Internal_convexOverlapAny(mesh, ref position, ref rotation, layer));
 }
Exemple #15
0
 private static extern void Internal_create0(Material managedInstance, RRef <Shader> shader);
Exemple #16
0
 private static extern bool Internal_convexCastAny(RRef <PhysicsMesh> mesh, ref Vector3 position, ref Quaternion rotation, ref Vector3 unitDir, ulong layer, float max);
Exemple #17
0
 private static extern void Internal_setTexture(IntPtr thisPtr, string name, RRef <Texture> value, int mipLevel, int numMipLevels, int arraySlice, int numArraySlices);
Exemple #18
0
 private static extern bool Internal_convexOverlapAny(RRef <PhysicsMesh> mesh, ref Vector3 position, ref Quaternion rotation, ulong layer);
Exemple #19
0
 private static extern void Internal_setfringeTexture(IntPtr thisPtr, RRef <Texture> value);