Table of Contents

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

entity Entity

Fields

AirDragValue

The amount of drag while travelling through the air.

public double AirDragValue

Field Value

double

BoyancyMul

The amount of drag while travelling on the ground.

public double BoyancyMul

Field Value

double

GravityPerSecond

The amount of gravity applied per tick to this entity.

public double GravityPerSecond

Field Value

double

GroundDragValue

The amount of drag while travelling on the ground.

public double GroundDragValue

Field Value

double

OnPhysicsTickCallback

If set, will test for entity collision every tick (expensive)

public Action<float> OnPhysicsTickCallback

Field Value

Action<float>

WaterDragValue

The amount of drag while travelling through water.

public double WaterDragValue

Field Value

double

collidedBefore

protected bool collidedBefore

Field Value

bool

feetInLiquidBefore

protected bool feetInLiquidBefore

Field Value

bool

motionBeforeY

protected double motionBeforeY

Field Value

double

newPos

protected Vec3d newPos

Field Value

Vec3d

onGroundBefore

protected bool onGroundBefore

Field Value

bool

prevPos

protected readonly Vec3d prevPos

Field Value

Vec3d

swimmingBefore

protected bool swimmingBefore

Field Value

bool

Properties

Entity

public Entity Entity { get; }

Property Value

Entity

Ticking

public bool Ticking { get; set; }

Property Value

bool

Methods

AfterPhysicsTick(float)

Called once per server tick, after all physics ticking has occurred; on main thread.

public void AfterPhysicsTick(float dt)

Parameters

dt float

ApplyTests(EntityPos)

public void ApplyTests(EntityPos pos)

Parameters

pos EntityPos

HandleRemotePhysics(float, bool)

public void HandleRemotePhysics(float dt, bool isTeleport)

Parameters

dt float
isTeleport bool

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

properties EntityProperties

The properties of this entity.

attributes JsonObject

The attributes of this entity.

IsFirstTick(Entity)

protected virtual bool IsFirstTick(Entity entity)

Parameters

entity Entity

Returns

bool

MotionAndCollision(EntityPos, float)

public void MotionAndCollision(EntityPos pos, float dt)

Parameters

pos EntityPos
dt float

OnEntityDespawn(EntityDespawnData)

The event fired when the entity is despawned.

public override void OnEntityDespawn(EntityDespawnData despawn)

Parameters

despawn EntityDespawnData

The 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

dt float

OnReceivedClientPos(int)

public void OnReceivedClientPos(int version)

Parameters

version int

PropertyName()

The name of the property tied to this entity behavior.

public override string PropertyName()

Returns

string

RemoteMotionAndCollision(EntityPos, float)

public void RemoteMotionAndCollision(EntityPos pos, float dtFactor)

Parameters

pos EntityPos
dtFactor float

SetProperties(JsonObject)

public virtual void SetProperties(JsonObject attributes)

Parameters

attributes JsonObject

SetState(EntityPos)

public void SetState(EntityPos pos)

Parameters

pos EntityPos

applyCollision(EntityPos, float)

protected virtual void applyCollision(EntityPos pos, float dtFactor)

Parameters

pos EntityPos
dtFactor float