void Update() { if (SyncWithUnityUpdate) { NativePhysics.WorldUpdate(UseUnscaledTime ? Time.unscaledDeltaTime : Time.deltaTime); } }
public void PolygonSetVertices(int handle, IEnumerable <Vector2> vertices) { ThrowExceptionIfNativeWorldDoesNotExist(); // Pack the vertices as an array of NativeVector2s. var transportVertices = vertices .Select(vertex => new TransportVector2(vertex)) .ToArray(); NativePhysics.PolygonSetVertices(handle, transportVertices, transportVertices.Length); }
public int PolygonCreate(IEnumerable <Vector2> vertices, Vector2 position, float rotation = 0f, float mass = 1f, bool useGravity = false, bool isStatic = false) { ThrowExceptionIfNativeWorldDoesNotExist(); // Pack the collection of Vector2s for transport (this also copies the array). var transportVertices = vertices .Select(vertex => new TransportVector2(vertex)) .ToArray(); return(NativePhysics.PolygonCreate(transportVertices, transportVertices.Length, new TransportVector2(position), rotation, mass, useGravity, isStatic)); }
public void PolygonDestroy(int handle) { NativePhysics.PolygonDestroy(handle); }
void OnDestroy() { NativePhysics.WorldDestroy(); DoesNativeWorldExist = false; }
void Awake() { NativePhysics.WorldStart(FixedTimestepSeconds, GravityAcceleration); DoesNativeWorldExist = true; }
public void PolygonAccelerateRotation(int handle, float dRotationalVelocity) { ThrowExceptionIfNativeWorldDoesNotExist(); NativePhysics.PolygonAccelerateRotation(handle, dRotationalVelocity); }
public Vector2 PolygonGetVelocity(int handle) { ThrowExceptionIfNativeWorldDoesNotExist(); return(NativePhysics.PolygonGetVelocity(handle).ToVector2()); }
public float PolygonGetRotationalVelocity(int handle) { ThrowExceptionIfNativeWorldDoesNotExist(); return(NativePhysics.PolygonGetRotationalVelocity(handle)); }
public void PolygonSetRotationalVelocity(int handle, float rotationalVelocity) { ThrowExceptionIfNativeWorldDoesNotExist(); NativePhysics.PolygonSetRotationalVelocity(handle, rotationalVelocity); }
public void PolygonRotate(int handle, float dRotation) { ThrowExceptionIfNativeWorldDoesNotExist(); NativePhysics.PolygonRotate(handle, dRotation); }
public void PolygonAccelerate(int handle, Vector2 dVelocity) { ThrowExceptionIfNativeWorldDoesNotExist(); NativePhysics.PolygonAccelerate(handle, new TransportVector2(dVelocity)); }
public void PolygonSetVelocity(int handle, Vector2 velocity) { ThrowExceptionIfNativeWorldDoesNotExist(); NativePhysics.PolygonSetVelocity(handle, new TransportVector2(velocity)); }
public float PolygonGetMass(int handle) { ThrowExceptionIfNativeWorldDoesNotExist(); return(NativePhysics.PolygonGetMass(handle)); }
public bool IsPolygonColliding(int handle) { ThrowExceptionIfNativeWorldDoesNotExist(); return(NativePhysics.IsPolygonColliding(handle)); }
public void PolygonSetMass(int handle, float mass) { ThrowExceptionIfNativeWorldDoesNotExist(); NativePhysics.PolygonSetMass(handle, mass); }
public void PolygonTranslate(int handle, Vector2 dPosition) { ThrowExceptionIfNativeWorldDoesNotExist(); NativePhysics.PolygonTranslate(handle, new TransportVector2(dPosition)); }