PhysicsBehaviour

class Varwin.PhysicsBehaviour

Bases: object

class Relativeness

Bases: object

Self: Any = Ellipsis
World: Any = Ellipsis
class GravityState

Bases: object

On: Any = Ellipsis
Off: Any = Ellipsis
class KinematicState

Bases: object

Kinematic: Any = Ellipsis
NonKinematic: Any = Ellipsis
class ObstacleState

Bases: object

Obstacle: Any = Ellipsis
NonObstacle: Any = Ellipsis
ApplyForceInDirection(force: float, direction: Vector3, relative: int) None

Instantly applies force to the object in the direction of the specified vector in the selected coordinate system. The value is measured in kg*m/s.

Parameters:

(int) (relative) –

value from the list

  • Varwin.PhysicsBehaviour.Relativeness.Self (int)

  • Varwin.PhysicsBehaviour.Relativeness.World (int)

Example:

instance.PhysicsBehaviour.ApplyForceInDirection(0, Varwin.Vector3(1,0,0), Varwin.PhysicsBehaviour.Relativeness.Self)
async StartApplyingForceInDirectionRelativeTo(force: float, direction: Vector3, duration: float, relative: int) None

Applies a force to an object in the direction of a specified vector in the selected coordinate system for the specified time. The value is measured in kg*m/s.

Parameters:

(int) (relative) –

value from the list

  • Varwin.PhysicsBehaviour.Relativeness.Self (int)

  • Varwin.PhysicsBehaviour.Relativeness.World (int)

Example:

await instance.PhysicsBehaviour.StartApplyingForceInDirectionRelativeTo(0, Varwin.Vector3(1,0,0), 0, Varwin.PhysicsBehaviour.Relativeness.Self)
Pause() None

Controls any force application to object. A paused force application can be continued with the “Continue” block.

Example:

instance.PhysicsBehaviour.Pause()
Continue() None

Controls any force application to object. A paused force application can be continued with the “Continue” block.

Example:

instance.PhysicsBehaviour.Continue()
Stop() None

Controls any force application to object. A paused force application can be continued with the “Continue” block.

Example:

instance.PhysicsBehaviour.Stop()
property Mass: float

Returns the value of the selected physical property of the object.

Example:

result = instance.PhysicsBehaviour.Mass
property Bounciness: float

Returns the value of the selected physical property of the object.

Example:

result = instance.PhysicsBehaviour.Bounciness
property Gravity: int

Sets whether gravity affects the object.

Example:

result = instance.PhysicsBehaviour.Gravity
property LinearDrag: float

Returns the value of the selected physical property of the object.

Example:

result = instance.PhysicsBehaviour.LinearDrag
property AngularDrag: float

Returns the value of the selected physical property of the object.

Example:

result = instance.PhysicsBehaviour.AngularDrag
property Acceleration: float

Returns the value of the selected physical property of the object.

Example:

result = instance.PhysicsBehaviour.Acceleration
property Speed: float

Returns the value of the selected physical property of the object.

Example:

result = instance.PhysicsBehaviour.Speed
property AngularSpeed: float

Returns the value of the selected physical property of the object.

Example:

result = instance.PhysicsBehaviour.AngularSpeed
property Kinematic: int

Sets whether the object is static. If the object is static, there are no physical forces acting on it.

Returns:

value from the list

  • Varwin.PhysicsBehaviour.KinematicState.Kinematic

  • Varwin.PhysicsBehaviour.KinematicState.NonKinematic

Example:

result = instance.PhysicsBehaviour.Kinematic
property Obstacle: int

Sets whether the specified object is an obstacle for the player and other objects.

Returns:

value from the list

  • Varwin.PhysicsBehaviour.ObstacleState.Obstacle

  • Varwin.PhysicsBehaviour.ObstacleState.NonObstacle

Example:

result = instance.PhysicsBehaviour.Obstacle
IsAffectedByForceNow() bool

Returns true if a force is currently being applied to the specified object. Otherwise, returns “false“

Example:

result = instance.PhysicsBehaviour.IsAffectedByForceNow()
AddApplicationOfForceCompletedHandler(handler: Callable[[Object], CoroutineType]) None

The event is triggered when the force has finished being applied to the object. The object for which the event was triggered is passed to the parameter.

Parameters:

handler

Asynchronous handler function with signature:

  • sender (Object): the object that triggered the event

Example:

async def OnApplicationOfForceCompleted(sender):
  ...
instance.PhysicsBehaviour.AddApplicationOfForceCompletedHandler(OnApplicationOfForceCompleted)