Class EntityBehaviorPassivePhysics
- Namespace
- Vintagestory.API.Common
- Assembly
- VintagestoryAPI.dll
public class EntityBehaviorPassivePhysics : PhysicsBehaviorBase, IPhysicsTickable, IRemotePhysics
- Inheritance
-
EntityBehaviorPassivePhysics
- Implements
- Inherited Members
- Extension Methods
Constructors
EntityBehaviorPassivePhysics(Entity)
public EntityBehaviorPassivePhysics(Entity entity)
Parameters
entityEntity
Fields
AirDragValue
The amount of drag while travelling through the air.
public double AirDragValue
Field Value
BoyancyMul
The amount of drag while travelling on the ground.
public double BoyancyMul
Field Value
GravityPerSecond
The amount of gravity applied per tick to this entity.
public double GravityPerSecond
Field Value
GroundDragValue
The amount of drag while travelling on the ground.
public double GroundDragValue
Field Value
OnPhysicsTickCallback
If set, will test for entity collision every tick (expensive)
public Action<float> OnPhysicsTickCallback
Field Value
WaterDragValue
The amount of drag while travelling through water.
public double WaterDragValue
Field Value
collidedBefore
protected bool collidedBefore
Field Value
feetInLiquidBefore
protected bool feetInLiquidBefore
Field Value
motionBeforeY
protected double motionBeforeY
Field Value
newPos
protected Vec3d newPos
Field Value
onGroundBefore
protected bool onGroundBefore
Field Value
prevPos
protected readonly Vec3d prevPos
Field Value
swimmingBefore
protected bool swimmingBefore
Field Value
Properties
Entity
public Entity Entity { get; }
Property Value
Ticking
public bool Ticking { get; set; }
Property Value
Methods
AfterPhysicsTick(float)
Called once per server tick, after all physics ticking has occurred; on main thread.
public void AfterPhysicsTick(float dt)
Parameters
dtfloat
ApplyTests(EntityPos)
public void ApplyTests(EntityPos pos)
Parameters
posEntityPos
HandleRemotePhysics(float, bool)
public void HandleRemotePhysics(float dt, bool isTeleport)
Parameters
Initialize(EntityProperties, JsonObject)
Initializes the entity.
If your code modifies the supplied attributes (not recommended!), then your changes will apply to all entities of the same type.
public override void Initialize(EntityProperties properties, JsonObject attributes)
Parameters
propertiesEntityPropertiesThe properties of this entity.
attributesJsonObjectThe attributes of this entity.
IsFirstTick(Entity)
protected virtual bool IsFirstTick(Entity entity)
Parameters
entityEntity
Returns
MotionAndCollision(EntityPos, float)
public void MotionAndCollision(EntityPos pos, float dt)
Parameters
OnEntityDespawn(EntityDespawnData)
The event fired when the entity is despawned.
public override void OnEntityDespawn(EntityDespawnData despawn)
Parameters
despawnEntityDespawnDataThe reason the entity despawned.
OnPhysicsTick(float)
Called at a fixed interval, potentially 30 times per second (if server is running smoothly)
public void OnPhysicsTick(float dt)
Parameters
dtfloat
OnReceivedClientPos(int)
public void OnReceivedClientPos(int version)
Parameters
versionint
PropertyName()
The name of the property tied to this entity behavior.
public override string PropertyName()
Returns
RemoteMotionAndCollision(EntityPos, float)
public void RemoteMotionAndCollision(EntityPos pos, float dtFactor)
Parameters
SetProperties(JsonObject)
public virtual void SetProperties(JsonObject attributes)
Parameters
attributesJsonObject
SetState(EntityPos)
public void SetState(EntityPos pos)
Parameters
posEntityPos
applyCollision(EntityPos, float)
protected virtual void applyCollision(EntityPos pos, float dtFactor)