BodyType()
Syntax: _BodyType(ImageName, bodyType)
Purpose: Assigns a physics body type to an image object, making it interact with the physics simulation.
Parameters:
ImageName: The name of the image object.
bodyType: One of the following:
"static": Immovable by physics forces.
"dynamic": Fully reactive to forces, collisions, and gravity.
"kinematic": Can be moved by you, but not directly affected by the physics engine.
Bounce()
Syntax: _Bounce(ImageName, bounce)
Purpose: Controls how much energy an object retains after a collision.
Parameters:
ImageName: The name of the image object.
bounce:
A value between 0 and 1.
* 0 means no bounce, all energy is
lost. * 1 means perfectly elastic, retaining full energy.
Create_Ragdoll()
Syntax: _Create_Ragdoll(Object_Name,x_base,y_base,ragdoll_image_suffix,Scale_x,Scale_y,Gravity_Scale,is_sensor,density,friction,bounce,new_outline,Array_csv_for_negative_positive_limits,Forced_a)
Purpose: Creates a physically simulated ragdoll figure comprised of multiple connected image parts.
Parameters (let me know if you want a detailed breakdown of each parameter, as there are many!)
Important Notes on Ragdoll Creation
Images: The system looks for specific image names or copies defaults from the Lu C installation.
Joints: Pivot joints are automatically created to connect the ragdoll body parts.
Let's Get Practical!
Would you like to:
Experiment with Basic Physics: Set up simple objects with different body types, densities, and bounce values, and see how they interact.
Build a Ragdoll: Create a ragdoll character and apply forces or explosions to make it tumble around.
Density()
Syntax: _Density(ImageName, density)
Purpose: Sets the density of a physics object, affecting how it responds to forces and collisions.
Parameters:
ImageName: Name of the image object.
density: Typically 1.0 for water-like density, less than 1 for lighter materials, or greater than 1 for heavier ones.
Display_Physics_MaskBits()
Syntax: _Display_Physics_MaskBits(K_orientation, J_formNumber)
Purpose: Outputs information to the console about the Categories and MaskBits for your physics objects. This is mainly for debugging.
Parameters:
K_orientation: 1 for portrait, 2 for landscape.
J_formNumber: An index (0 to 99) for referencing physics object data.
Draw_Mode()
Syntax: _Draw_Mode(physics_mode)
Purpose: Sets the visual debug rendering mode for the physics engine in the simulator.
Parameters:
physics_mode:
"normal": No debug visualization.
"hybrid": Basic outlines showing body types.
"debug": Detailed outlines, vectors, and joint visualizations.
Enclosure_Physics()
Syntax: _Enclosure_Physics(Enclosure_Name, bodyType, isBullet, density, friction, bounce, radius, isSensor, gravityScale)
Purpose:
Applies physics properties to an Enclosure object you've created
with _Create_Enclosure
.
Parameters:
Enclosure_Name: The name you assigned when creating the enclosure.
bodyType: (required) "static", "dynamic", or "kinematic".
Other
parameters:
These function the same as in Image_Physics
.
Explosion()
Syntax: _Explosion(x, y, force, accuracy)
Purpose: Simulates an explosion at a given point, applying forces to physics objects in the vicinity.
Parameters:
x, y: Coordinates of the explosion center.
force: Strength of the explosion.
accuracy (optional): Affects how many objects it interacts with (higher = more objects, but more CPU usage).
Friction()
Syntax: _Friction(ImageName, friction)
Purpose: Controls how much resistance an object has to sliding across other objects.
Parameters:
ImageName: The name of the image object.
friction: A value between 0 and 1.
0 means frictionless
1 means very high friction.
Get_...() Functions
Get_BodyType(), Get_Bounce(), Get_Density(), Get_Friction() : These commands retrieve the current physics properties of an object, allowing you to check or potentially modify them on the fly.
Get_Gravity()
Syntax: _Get_Gravity()
Purpose: Retrieves the current global gravity values as x and y components (in meters/second^2)
Get_Gravity_Scale()
Syntax: _Get_Gravity_Scale(ImageName)
Purpose: Gets the gravity scale factor specifically for an image object. This modifies how much the global gravity affects that object.
Get_Image_...() Functions
Get_Image_Angular_Velocity(), Get_Image_Linear_Velocity(): Retrieve an object's current rotational velocity (degrees/second) and its linear velocity (pixels/second) respectively.
Get_Is_...() Functions
Get_Is_Bullet(), Get_Is_Sensor(), Get_NewOutline(), Get_Radius(), Get_Sleeping(): These commands retrieve various property states (bullet status, sensor flag, etc.) of a physics object.
Gravity()
Syntax: _Gravity(xG, yG)
Purpose: Sets the global gravity vector for your physics simulation.
Parameters:
xG, yG: The x and y components of gravity in meters/second^2.
Let's Build Something!
Are you interested in:
Fine-Tuning Object Behavior: Experimenting with getting and setting physics properties to change how objects move and interact in your scene.
Reading
an Object's State:
Using commands like Get_Image_Linear_Velocity
to make gameplay decisions or create visual effects based on an
object's motion.
Image_...() Functions
Let's
focus on the Image_
commands. These are for direct manipulation of physics objects.
Image_Angular_Velocity(): Sets an object's rotational speed (degrees/second).
Image_Constant_Push()
and Image_Single_Push():
Apply forces to an object. Constant
is a continuous force, while Single
is a one-time impulse.
Image_Constant_Torque() and Image_Single_Torque(): Apply a rotational force (torque) to an object. Similar to the push functions, one is continuous, the other is a single impulse.
Image_Linear_Velocity(): Sets an object's linear velocity (pixels/second).
Image_Physics(): The primary way to assign and modify the core physics properties of an image object (bodyType, density, bounce, etc.).
Image_Remove_Physics(): Removes all physics properties from an image, making it non-interactive within the physics simulation.
Image_Reset_Velocity(): Zeros out an object's linear and angular velocity, effectively bringing it to rest.
Is_...() Functions
Is_Awake(), Is_Fixed_Rotation(), Is_Sensor(), Is_Sleeping_Allowed(): These functions let you change certain behaviors of a physics object: whether it can 'sleep' to save resources, rotate, or act as a sensor without reacting physically.
NewOutline()
Syntax: _NewOutline(ImageName, newOutline)
Purpose:
Influences the collision shape calculation for physics objects. The
meaning of newOutline
depends on the image type.
Physics_Pause() and Physics_Start()
These commands respectively pause and resume the entire physics simulation.
Radius()
Syntax: _Radius(ImageName, Radius)
Purpose: Sets a circular collision radius for an object. Useful for simplifying collisions on objects that aren't perfectly rectangular.
Ragdoll_Name()
Syntax: _Ragdoll_Name(Object_Name)
Purpose: Used during collision detection to retrieve the name of the ragdoll that an object (likely a ragdoll part) belongs to.