Entity/Physicalize

From Blue Mars Developer Guidebook

Jump to: navigation, search


This is an Entity function

Physicalize(slot,type,params)
create a physical entity from the specified entity slot
slot - entity slot
type - physics type, one of
PE_NONE
no physics
PE_STATIC
static physical entity
PE_LIVING
a live physical entity (player, monsters)
PE_RIGID
a rigid body physical entity
PE_WHEELEDVEHICLE
a physical vehicle with wheels
PE_PARTICLE
a particle physical entity, only has mass and radius
PE_ARTICULATED
ragdolls or other articulated physical entities
PE_ROPE
physical representation of a rope
PE_SOFT
softbody physics, e.g. cloth simulation
PE_AREA
a physical area, e.g. sphere, box, geometry or shape
params - a table containing parameters,
mass
object mass, only used if density is not specified or -1
density
object density, only used if mass is not specified or -1
flags
physical entity flags
partid
index of the articulated body part that this new physical entity will be attached to
stiffness_scale
scale of character joints stiffness (multiplied with stiffness values in exported model)
Particle
a table that must be supplied when the physicsType is PE_PARTICLE
mass
particle mass
radius
particle pseudo radius
thickness
thickness when lyingon a surface (if 0, radius will be used)
velocity
velocity direction and magnitude vector
air_resistance
air resistance coefficient, F=kv
water_resistance
water resistance coefficient, F=kv
gravity
gravity force vector to the air
water_gravity
gravity force vector when in the water
min_bounce_vel
minimal velocity at which particle bounces off the surface
accel_thrust
acceleration along direction of movement
accel_lift
acceleration that lifts particle with the current speed
constant_orientation
1 indicates keep constant orientation, 0 otherwise
single_contact
1 indicates keep calculate only first contact, 0 otherwise
no_roll
1 indicates do not roll particle on terrain , 0 otherwise
no_spin
1 indicates do not spin particle in air, 0 otherwise
no_path_alignment
1 indicates do not aligh particle orientation to the movement path, 0 otherwise
Living
a table that must be supplied when the physicsType is PE_LIVING
height
vertical offset of collision geometry center
size
collision cylinder dimensions, a vector
height_eye
vertical offset of the camera
height_pivot
offset from central ground position that is considered the entity center
height_head
vertical offset of the head
inertia
inertia coefficient, higher means less inertia, 0 means no inertia
air_resistance
air control coefficient, 0.0-1.0, where 1 is special (total control of movement)
gravity
vertical gravity magnitude
mass
mass of the player, in kg
min_slide_angle
if surface slope is more than this angle (in radians), player starts sliding
max_climb_angle
player cannot climb surface with slope steeper than this angle, in radians
max_jump_angle
player cannot jump towards ground if this angle is exceeded
min_fall_angle
player starts falling when slope is steeper than this, in radians
max_vel_ground
player cannot stand on surfaces that are moving faster than this
Area
a table that must be supplied when the physics type is PE_AREA
type
type of the area,

AREA_BOX, AREA_SPHERE, AREA_GEOMETRY, AREA_SHAPE, AREA_CYLINDER, AREA_SPLINE

radius
radius of the area sphere, required if the area type is AREA_SPHERE
box_min
min vector of the bounding box, rquired if the area type is AREA_BOX
box_max
max vector of the bounding box, rquired if the area type is AREA_BOX
points
table containing collection of vectors in local entity space defining the 2D shape of the area, if the area type is AREA_SHAPE
height
height of the 2D area, relative to the minimal Z in the points table, if the area type is AREA_SHAPE
uniform
same direction in every point or always point to the center
falloff
ellipsoidal falloff dimensions, a vector. zero vector if no falloff
gravity
gravity vector inside the physical area

Examples:

Elevator.lua and ElevatorSwitch.lua

self:Physicalize(0,PE_RIGID, {mass=0});

Alien_x.lua

entity:Physicalize(0, PE_LIVING, entity.physicsParams);

Shark_x.lua

self:Physicalize( 0,PE_ARTICULATED,self.PhysParams );

rope.lua

self:Physicalize(0, PE_ROPE, self.Properties);

WindArea.lua

self:Physicalize( 0,PE_AREA,self._PhysTable );
Problems with this wiki page? Contact us either by: Support Email or Support Ticket System

Blue Mars Guidebook Privacy Policy
Blue Mars Guidebook Community Guidelines

Personal tools