public CircleCollider setRadius(float radius) { if (radius != ((Circle)shape).radius) { ((Circle)shape).radius = radius; _isPositionDirty = true; if (entity != null && _isParentEntityAddedToScene) { Physics.updateCollider(this); } } return(this); }
public CircleCollider setRadius(float radius) { if (radius != ((Circle)shape).radius) { // store the old bounds so we can update ourself after modifying them var oldBounds = bounds; ((Circle)shape).radius = radius; _areBoundsDirty = true; if (entity != null && _isParentEntityAddedToScene) { Physics.updateCollider(this); } } return(this); }
public BoxCollider setHeight(float height) { var box = shape as Box; if (height != box.height) { // update the box and if we need to update our bounds in the Physics system box.updateBox(box.width, height); if (entity != null && _isParentEntityAddedToScene) { Physics.updateCollider(this); } } return(this); }
public BoxCollider setWidth(float width) { var box = shape as Box; if (width != box.width) { // update the box, dirty our bounds and if we need to update our bounds in the Physics system box.updateBox(width, box.height); _isPositionDirty = true; if (entity != null && _isParentEntityAddedToScene) { Physics.updateCollider(this); } } return(this); }
public BoxCollider setHeight(float height) { if (height != ((Box)shape).height) { // store the old bounds so we can update ourself after modifying them var oldBounds = bounds; ((Box)shape).height = height; _areBoundsDirty = true; if (entity != null && _isParentEntityAddedToScene) { Physics.updateCollider(this); } } return(this); }
public BoxCollider setWidth(float width) { if (width != ((Box)shape).width) { // store the old bounds so we can update ourself after modifying them var oldBounds = bounds; ((Box)shape).width = width; _areBoundsDirty = true; if (entity != null && _isParentEntityAddedToScene) { Physics.updateCollider(this, ref oldBounds); } } return(this); }
/// <summary> /// sets the size of the BoxCollider /// </summary> /// <returns>The size.</returns> /// <param name="width">Width.</param> /// <param name="height">Height.</param> public BoxCollider setSize(float width, float height) { _colliderRequiresAutoSizing = false; var box = shape as Box; if (width != box.width || height != box.height) { // update the box, dirty our bounds and if we need to update our bounds in the Physics system box.updateBox(width, height); _isPositionDirty = true; if (entity != null && _isParentEntityAddedToScene) { Physics.updateCollider(this); } } return(this); }
/// <summary> /// sets the radius for the CircleCollider /// </summary> /// <returns>The radius.</returns> /// <param name="radius">Radius.</param> public CircleCollider setRadius(float radius) { _colliderRequiresAutoSizing = false; var circle = shape as Circle; if (radius != circle.radius) { circle.radius = radius; circle._originalRadius = radius; _isPositionDirty = true; if (entity != null && _isParentEntityAddedToScene) { Physics.updateCollider(this); } } return(this); }
public virtual void onEntityTransformChanged(Transform.Component comp) { // set the appropriate dirty flags switch (comp) { case Transform.Component.Position: _isPositionDirty = true; break; case Transform.Component.Scale: _isPositionDirty = true; break; case Transform.Component.Rotation: _isRotationDirty = true; break; } if (_isColliderRegistered) { Physics.updateCollider(this); } }