public Vector3D GetCollisionResultPoint(TriangleSelector selector, Vector3D ellipsoidPosition, Vector3D ellipsoidRadius, Vector3D ellipsoidDirectionAndSpeed, out Triangle3D outTriangle, out bool outFalling, float slidingSpeed, Vector3D gravityDirectionAndSpeed) { float[] outtri = new float[9]; float[] outpos = new float[3]; outFalling = false; SceneCollisionManager_GetCollisionResultPoint(_raw, selector.Raw, ellipsoidPosition.ToUnmanaged(), ellipsoidRadius.ToUnmanaged(), ellipsoidDirectionAndSpeed.ToUnmanaged(), outtri, ref outFalling, slidingSpeed, gravityDirectionAndSpeed.ToUnmanaged(), outpos); outTriangle = Triangle3D.FromUnmanaged(outtri); return Vector3D.FromUnmanaged(outpos); }
public bool GetCollisionPoint(Line3D ray, TriangleSelector selector, out Vector3D collisionPoint, out Triangle3D collisionTriangle) { float[] colp = new float[3]; float[] coltri = new float[9]; bool toR = SceneCollisionManager_GetCollisionPoint(_raw, ray.ToUnmanaged(), selector.Raw, colp, coltri); collisionPoint = Vector3D.FromUnmanaged(colp); collisionTriangle = Triangle3D.FromUnmanaged(coltri); return toR; }
/// <summary> /// Creates a simple animator for collision detection /// </summary> /// <returns>An Animator</returns> /// <param name="world">"World", meaning the triangle selector of the terrain/map</param> /// <param name="node">Node. Notice that this node MUST BE THE ONE THE ANIMATOR IS ADDED</param> /// <param name="ellipsoidRadius">Ellipsoid radius. Usually it's the difference between the node's skybox's max edge and its center</param> /// <param name="gravityPerSecond">How much gravity (don't try (0, -100000, 0), even on Jupiter you wouldn't have such gravity)</param> /// <param name="ellipsoidTranslation">By default (0, 0, 0), meaning the center of the scene node. You can modify it if needed</param> /// <param name="slidingValue">Sliding value, usually 0.0005f</param> public Animator CreateCollisionResponseAnimator(TriangleSelector world, SceneNode node, Vector3D ellipsoidRadius, Vector3D gravityPerSecond, Vector3D ellipsoidTranslation, float slidingValue) { return (Animator) NativeElement.GetObject(SceneManager_CreateCollisionResponseAnimator(_raw, world.Raw, node.Raw, ellipsoidRadius.ToUnmanaged(), gravityPerSecond.ToUnmanaged(), ellipsoidTranslation.ToUnmanaged(), slidingValue), typeof(Animator)); }
/// <summary> /// Removes a specific triangle selector which was added before from the collection. /// </summary> /// <param name="toRemove">Triangle selector which is in the list but will be removed.</param> public void RemoveTriangleSelector(TriangleSelector toRemove) { MetaTriangleSelector_RemoveTriangleSelector(_raw, toRemove.Raw); }
/// <summary> /// Adds a triangle selector to the collection of triangle selectors in this metaTriangleSelector. /// </summary> /// <param name="toAdd">Triangle selector to add to the list</param> public void AddTriangleSelector(TriangleSelector toAdd) { MetaTriangleSelector_AddTriangleSelector(_raw, toAdd.Raw); }
public void AddTriangleSelector(TriangleSelector trisel, SceneNode node) { lock (trisel) { trilist.Add(trisel); if (triLookup.ContainsKey(trisel.Raw)) triLookup[trisel.Raw] = node; else triLookup.Add(trisel.Raw, node); } }
public void RemTriangleSelector(TriangleSelector trisel) { if (trisel != null) { lock (trisel) { trilist.Remove(trisel); if (triLookup.ContainsKey(trisel.Raw)) triLookup.Remove(trisel.Raw); } } }