ColliderComponent
Declaration
public abstract class Strawberry.Components.Physics.ColliderComponent
Base class for colliders. The collider's shape will be created in the next FixedUpdate iteration.
Inherits: Strawberry.Core.BaseComponent
Properties
Transform
Gets the transform of the owner
TransformComponent Transform { get }
RigidBody
The rigid body owning this collider
RigidBodyComponent RigidBody { get }
Fixture abstract
The underlying fixture of the collider
Fixture Fixture { get }
Sensor
bool Sensor { get set }
Restitution
Gets or sets the coefficient of restitution. This will not affect existing contacts.
float Restitution { get set }
Friction
Gets or sets the coefficient of friction between the collider and other objects. This will not affect existing contacts.
float Friction { get set }
Density
Gets or sets density. Changing density will recalculate the shape properties.
float Density { get set }
CollisionCategories
The collision category this collider belongs to. (Default is Category.Cat1)
Category CollisionCategories { get set }
CollidesWith
The collision category this collider would accept for collision. (Default is Category.All)
Category CollidesWith { get set }
Methods
OnComponentAdded override
void OnComponentAdded(BaseComponent component)
Parameters:
| Name | Type | Description |
|---|---|---|
component |
Strawberry.Core.BaseComponent |
EnableCollisionEvent
Enables collision callbacks for the fixture.
void EnableCollisionEvent()
Collision protected virtual
bool Collision(Fixture firstBody, Fixture secondBody, Contact contact)
Parameters:
| Name | Type | Description |
|---|---|---|
firstBody |
tainicom.Aether.Physics2D.Dynamics.Fixture |
|
secondBody |
tainicom.Aether.Physics2D.Dynamics.Fixture |
|
contact |
tainicom.Aether.Physics2D.Dynamics.Contacts.Contact |
CreateFixture protected abstract
Creates the fixture
void CreateFixture(Body body)
Parameters:
| Name | Type | Description |
|---|---|---|
body |
tainicom.Aether.Physics2D.Dynamics.Body |
The body owning this fixture |
OnFinished override
void OnFinished()
FixtureRecreated protected virtual
void FixtureRecreated(Fixture oldFixture, Fixture newFixture)
Parameters:
| Name | Type | Description |
|---|---|---|
oldFixture |
tainicom.Aether.Physics2D.Dynamics.Fixture |
|
newFixture |
tainicom.Aether.Physics2D.Dynamics.Fixture |
OnFixedUpdate override
void OnFixedUpdate()