Pular para o conteúdo principal

Kit physics

58 ferramentas. Gerado a partir do código-fonte do plugin; não edite manualmente.

As descrições das ferramentas e dos argumentos são exibidas em inglês porque espelham o schema das ferramentas (o mesmo texto que o agente recebe em tools/list).

Guia​

Use physics for project physics policy, physical-material assets, and collision queries during Play-in-Editor. Use component to change a component's collision and simulation settings, mesh for static mesh collision, and skel for PhysicsAssets.

For a selected primitive component, physics.inspect_body starts a physics-profile workflow. Use the typed body collision, simulation, gravity, damping, mass, and hit-event tools to prepare it, then run PIE and use the live velocity, wake/sleep, impulse, force, torque, and velocity tools.

Start by discovering the project contract:

physics.get_project_settings {}
physics.list_surface_types {}
physics.list_collision_channels {}
physics.list_collision_profiles {}

Project timing and named surfaces are persistent configuration changes and therefore require confirmation under the normal risk policy:

physics.set_project_settings {"substepping":"true","maxSubstepDeltaTime":"0.008333","maxSubsteps":"8"}
physics.set_surface_types {"surfaces":[{"type":1,"name":"Concrete"},{"type":2,"name":"Mud"}]}

Create the physical material through the asset kit, then tune its response here. density is in g/cm³; friction is non-negative and restitution is from 0 to 1:

asset.create_physical_material {"folder":"/Game/Physics","name":"PM_Rubber"}
physics.duplicate_material {"source":"/Engine/EngineMaterials/DefaultPhysicalMaterial","destination":"/Game/Physics/PM_Ice"}
physics.set_material {"material":"/Game/Physics/PM_Rubber","friction":"1.1","staticFriction":"1.3","restitution":"0.65","density":"1.2","surfaceType":"2","overrideFrictionCombineMode":"true","frictionCombineMode":"max"}
physics.get_material {"material":"/Game/Physics/PM_Rubber"}

Assign the material to a mesh component with component.set_physics, or to a material asset with material.set_physical_material; those tools own the assignment relationship.

While PIE is running, query the runtime world by any listed channel. The queries report only the first blocking response. Pass actor labels in ignoreActors when the trace origin belongs to the player or a probe actor:

physics.line_trace {"start":{"x":0,"y":0,"z":500},"end":{"x":0,"y":0,"z":-500},"channel":"Visibility","ignoreActors":["Player"]}
physics.sweep {"shape":"sphere","start":{"x":0,"y":0,"z":100},"end":{"x":1000,"y":0,"z":100},"radius":25,"channel":"Camera"}
physics.overlap_blocking {"shape":"box","start":{"x":500,"y":0,"z":100},"radius":50,"halfHeight":50,"extentZ":100,"channel":"Visibility"}

Box dimensions use radius, halfHeight, and extentZ as X/Y/Z half extents. A capsule needs halfHeight >= radius. line_trace, sweep, and overlap_blocking require an active PIE world; they intentionally do not run against the editor world.

Test bodies and constraints​

The body and constraint tools need a placed actor. To experiment without touching project actors, spawn a movable engine-cube body and a PhysicsConstraintActor (its component is always MyConstraintComp), edit them, then delete them. Engine physical materials are read-only; copy one with physics.duplicate_material before physics.set_material.

physics.spawn_body_actor {"label":"Crate","location":{"x":0,"y":0,"z":300}}
physics.spawn_constraint_actor {"label":"Hinge","actor1":"Crate","location":{"x":0,"y":0,"z":350}}
physics.set_constraint_swing1_limit {"actor":"Hinge","component":"MyConstraintComp","motion":"limited","limit":30}
physics.delete_actors {"actors":["Hinge","Crate"]}

During PIE use the transient variants, which spawn into the play world and initialise the constraint immediately; they disappear when PIE stops:

physics.spawn_test_body {"label":"Crate","location":{"x":0,"y":0,"z":300},"simulate":true}
physics.spawn_test_constraint {"label":"Hinge","actor1":"Crate"}
physics.apply_body_impulse {"actor":"Crate","vector":{"x":0,"y":0,"z":500},"velocityChange":true}
physics.get_constraint_force {"actor":"Hinge","component":"MyConstraintComp"}

physics.delete_actors only removes actors that own a primitive or constraint component (use actor.delete for anything else). Editor-world spawns are undoable; PIE spawns are not recorded.

Ferramentas​

Legenda. risco 0 = somente leitura, 1 = operação inofensiva do editor, 2 = altera asset, 3 = apaga/substitui asset, 4 = projeto/config/build, 5 = potencialmente destrutivo (chamadas acima de MaxAutoRisk exigem "_confirm": true). altera = roda numa transação (edit.undo reverte). requer PIE / requer mundo = recusado sem sessão PIE / sem nível aberto. requer plugin = indisponível quando o plugin está desativado. dryRun = aceita o argumento dryRun. smoke = coberto por edit.self_test.

physics.apply_body_force (risco 2, altera, requer PIE, smoke)​

Sem descrição.

ArgumentoTipoDescrição
vector{x,y,z}obrigatório. Force, impulse, torque, or location vector.
velocityChangebooleanTreat an impulse as a velocity change. Padrão false.

Retorna: actor, component, values, message.

physics.apply_body_impulse (risco 2, altera, requer PIE, smoke)​

Sem descrição.

ArgumentoTipoDescrição
vector{x,y,z}obrigatório. Force, impulse, torque, or location vector.
velocityChangebooleanTreat an impulse as a velocity change. Padrão false.

Retorna: actor, component, values, message.

physics.apply_body_impulse_at_location (risco 2, altera, requer PIE, smoke)​

Sem descrição.

ArgumentoTipoDescrição
impulse{x,y,z}obrigatório. Impulse vector.
location{x,y,z}obrigatório. World location in centimetres.

Retorna: actor, component, values, message.

physics.apply_body_torque (risco 2, altera, requer PIE, smoke)​

Sem descrição.

ArgumentoTipoDescrição
vector{x,y,z}obrigatório. Force, impulse, torque, or location vector.
velocityChangebooleanTreat an impulse as a velocity change. Padrão false.

Retorna: actor, component, values, message.

physics.break_constraint (risco 2, altera, requer PIE, smoke)​

Sem descrição.

ArgumentoTipoDescrição
actorstringobrigatório. Actor label, name, or path.
componentstringobrigatório. PhysicsConstraintComponent name.

Retorna: constraint, values.

physics.clear_body_mass_override (risco 2, altera, requer mundo, smoke)​

Sem descrição.

ArgumentoTipoDescrição
actorstringobrigatório. Actor label, name, or path in the editor or PIE world.
componentstringPrimitive component name; empty selects the first primitive component.

Retorna: actor, component, values, message.

physics.delete_actors (risco 3, altera, destrutivo, requer mundo, smoke)​

Deletes actors that own a primitive or physics-constraint component from the editor world (or the PIE world while PIE runs).

ArgumentoTipoDescrição
actorsarray of stringobrigatório. Actor labels, names, or paths. Each must own a primitive or constraint component.

Retorna: values, surfaces, channels, message.

physics.disable_constraint_collision (risco 2, altera, requer mundo, smoke)​

Sem descrição.

ArgumentoTipoDescrição
enabledbooleanobrigatório. New enabled state.

Retorna: constraint, values.

physics.duplicate_material (risco 2, altera, smoke)​

Copies a PhysicalMaterial (engine or project) to a new project asset so it can be edited with physics.set_material.

ArgumentoTipoDescrição
sourcestringobrigatório. Source PhysicalMaterial asset path (engine assets allowed).
destinationstringobrigatório. Destination object path, for example /Game/Physics/PM_Rubber.

Retorna: material, friction, staticFriction, restitution, density, surfaceType, overrideFrictionCombineMode, frictionCombineMode, overrideRestitutionCombineMode, restitutionCombineMode.

physics.enable_body_gravity (risco 2, altera, requer mundo, smoke)​

Sem descrição.

ArgumentoTipoDescrição
enabledbooleanobrigatório. New enabled state.

Retorna: actor, component, values, message.

physics.enable_body_hit_events (risco 2, altera, requer mundo, smoke)​

Sem descrição.

ArgumentoTipoDescrição
enabledbooleanobrigatório. New enabled state.

Retorna: actor, component, values, message.

physics.enable_body_simulation (risco 2, altera, requer mundo, smoke)​

Sem descrição.

ArgumentoTipoDescrição
enabledbooleanobrigatório. New enabled state.

Retorna: actor, component, values, message.

physics.get_body_angular_velocity (risco 0, requer PIE, smoke)​

Sem descrição.

ArgumentoTipoDescrição
actorstringobrigatório. Actor label, name, or path in the editor or PIE world.
componentstringPrimitive component name; empty selects the first primitive component.

Retorna: actor, component, values, message.

physics.get_body_velocity (risco 0, requer PIE, smoke)​

Sem descrição.

ArgumentoTipoDescrição
actorstringobrigatório. Actor label, name, or path in the editor or PIE world.
componentstringPrimitive component name; empty selects the first primitive component.

Retorna: actor, component, values, message.

physics.get_constraint_force (risco 0, requer PIE, smoke)​

Sem descrição.

ArgumentoTipoDescrição
actorstringobrigatório. Actor label, name, or path.
componentstringobrigatório. PhysicsConstraintComponent name.

Retorna: constraint, values.

physics.get_material (risco 0, smoke)​

Returns the portable physical response values of a PhysicalMaterial asset.

ArgumentoTipoDescrição
materialstringobrigatório. PhysicalMaterial asset path or unique name.

Retorna: material, friction, staticFriction, restitution, density, surfaceType, overrideFrictionCombineMode, frictionCombineMode, overrideRestitutionCombineMode, restitutionCombineMode.

physics.get_project_settings (risco 0, smoke)​

Returns cross-version project physics timing and degree-of-freedom defaults.

Sem argumentos.

Retorna: values, surfaces, channels, message.

physics.inspect_body (risco 0, requer mundo, smoke)​

Sem descrição.

ArgumentoTipoDescrição
actorstringobrigatório. Actor label, name, or path in the editor or PIE world.
componentstringPrimitive component name; empty selects the first primitive component.

Retorna: actor, component, values, message.

physics.inspect_constraint (risco 0, requer mundo, smoke)​

Sem descrição.

ArgumentoTipoDescrição
actorstringobrigatório. Actor label, name, or path.
componentstringobrigatório. PhysicsConstraintComponent name.

Retorna: constraint, values.

physics.line_trace (risco 0, requer PIE, smoke)​

Performs a blocking line trace in the active PIE world.

ArgumentoTipoDescrição
start{x,y,z}obrigatório. Query start in centimetres.
end{x,y,z}obrigatório. Query end in centimetres.

Retorna: hit, hit, message.

physics.list_collision_channels (risco 0, smoke)​

Lists engine and project collision-channel names for scene queries.

Sem argumentos.

Retorna: values, surfaces, channels, message.

physics.list_collision_profiles (risco 0, smoke)​

Lists collision profiles; component.physics owns applying a profile to a component.

Sem argumentos.

Retorna: values, surfaces, channels, message.

physics.list_surface_types (risco 0, smoke)​

Lists project-defined physical surface names.

Sem argumentos.

Retorna: values, surfaces, channels, message.

physics.overlap_blocking (risco 0, requer PIE, smoke)​

Tests whether a sphere, box, or capsule overlaps a blocking object in the active PIE world.

ArgumentoTipoDescrição
shapestringShape kind: sphere, box, or capsule. Padrão TEXT("sphere").
start{x,y,z}obrigatório. Start / overlap centre in centimetres.
end{x,y,z}Sweep end in centimetres; ignored by overlap.
radiusnumberSphere radius, capsule radius, or box X half extent in centimetres. Padrão 50.0.
halfHeightnumberCapsule half-height or box Y half extent in centimetres. Padrão 50.0.
extentZnumberBox Z half extent in centimetres. Padrão 50.0.
rotation{x,y,z}Shape rotation in degrees for box and capsule queries.

Retorna: hit, hit, message.

physics.set_body_angular_damping (risco 2, altera, requer mundo, smoke)​

Sem descrição.

ArgumentoTipoDescrição
valuenumberobrigatório. Value in the units named by the tool.

Retorna: actor, component, values, message.

physics.set_body_channel_response (risco 2, altera, requer mundo, smoke)​

Sem descrição.

ArgumentoTipoDescrição
channelstringobrigatório. Collision channel name.
responsestringobrigatório. ignore, overlap, or block.

Retorna: actor, component, values, message.

physics.set_body_collision_mode (risco 2, altera, requer mundo, smoke)​

Sem descrição.

ArgumentoTipoDescrição
modestringobrigatório. no_collision, query_only, physics_only, or query_and_physics.

Retorna: actor, component, values, message.

physics.set_body_collision_profile (risco 2, altera, requer mundo, smoke)​

Sem descrição.

ArgumentoTipoDescrição
profilestringobrigatório. Registered collision-profile name.

Retorna: actor, component, values, message.

physics.set_body_linear_damping (risco 2, altera, requer mundo, smoke)​

Sem descrição.

ArgumentoTipoDescrição
valuenumberobrigatório. Value in the units named by the tool.

Retorna: actor, component, values, message.

physics.set_body_linear_velocity (risco 2, altera, requer PIE, smoke)​

Sem descrição.

ArgumentoTipoDescrição
vector{x,y,z}obrigatório. Force, impulse, torque, or location vector.
velocityChangebooleanTreat an impulse as a velocity change. Padrão false.

Retorna: actor, component, values, message.

physics.set_body_mass_kg (risco 2, altera, requer mundo, smoke)​

Sem descrição.

ArgumentoTipoDescrição
valuenumberobrigatório. Value in the units named by the tool.

Retorna: actor, component, values, message.

physics.set_constraint_angular_break (risco 2, altera, requer mundo, smoke)​

Sem descrição.

ArgumentoTipoDescrição
enabledbooleanobrigatório. Enable breaking.
thresholdnumberobrigatório. Break threshold.

Retorna: constraint, values.

physics.set_constraint_angular_drive_params (risco 2, altera, requer mundo, smoke)​

Sem descrição.

ArgumentoTipoDescrição
positionStrengthnumberobrigatório. Position gain.
velocityStrengthnumberobrigatório. Velocity gain.
forceLimitnumberobrigatório. Force limit.

Retorna: constraint, values.

physics.set_constraint_angular_orientation_drive (risco 2, altera, requer mundo, smoke)​

Sem descrição.

ArgumentoTipoDescrição
xbooleanEnable X. Padrão false.
ybooleanEnable Y. Padrão false.
zbooleanEnable Z. Padrão false.

Retorna: constraint, values.

physics.set_constraint_angular_velocity_drive (risco 2, altera, requer mundo, smoke)​

Sem descrição.

ArgumentoTipoDescrição
xbooleanEnable X. Padrão false.
ybooleanEnable Y. Padrão false.
zbooleanEnable Z. Padrão false.

Retorna: constraint, values.

physics.set_constraint_angular_velocity_target (risco 2, altera, requer mundo, smoke)​

Sem descrição.

ArgumentoTipoDescrição
value{x,y,z}obrigatório. Target position, velocity, or angular velocity.

Retorna: constraint, values.

physics.set_constraint_linear_break (risco 2, altera, requer mundo, smoke)​

Sem descrição.

ArgumentoTipoDescrição
enabledbooleanobrigatório. Enable breaking.
thresholdnumberobrigatório. Break threshold.

Retorna: constraint, values.

physics.set_constraint_linear_drive_params (risco 2, altera, requer mundo, smoke)​

Sem descrição.

ArgumentoTipoDescrição
positionStrengthnumberobrigatório. Position gain.
velocityStrengthnumberobrigatório. Velocity gain.
forceLimitnumberobrigatório. Force limit.

Retorna: constraint, values.

physics.set_constraint_linear_position_drive (risco 2, altera, requer mundo, smoke)​

Sem descrição.

ArgumentoTipoDescrição
xbooleanEnable X. Padrão false.
ybooleanEnable Y. Padrão false.
zbooleanEnable Z. Padrão false.

Retorna: constraint, values.

physics.set_constraint_linear_position_target (risco 2, altera, requer mundo, smoke)​

Sem descrição.

ArgumentoTipoDescrição
value{x,y,z}obrigatório. Target position, velocity, or angular velocity.

Retorna: constraint, values.

physics.set_constraint_linear_velocity_drive (risco 2, altera, requer mundo, smoke)​

Sem descrição.

ArgumentoTipoDescrição
xbooleanEnable X. Padrão false.
ybooleanEnable Y. Padrão false.
zbooleanEnable Z. Padrão false.

Retorna: constraint, values.

physics.set_constraint_linear_velocity_target (risco 2, altera, requer mundo, smoke)​

Sem descrição.

ArgumentoTipoDescrição
value{x,y,z}obrigatório. Target position, velocity, or angular velocity.

Retorna: constraint, values.

physics.set_constraint_linear_x_limit (risco 2, altera, requer mundo, smoke)​

Sem descrição.

ArgumentoTipoDescrição
motionstringobrigatório. free, limited, or locked.
limitnumberobrigatório. Limit distance cm or angle degrees.

Retorna: constraint, values.

physics.set_constraint_linear_y_limit (risco 2, altera, requer mundo, smoke)​

Sem descrição.

ArgumentoTipoDescrição
motionstringobrigatório. free, limited, or locked.
limitnumberobrigatório. Limit distance cm or angle degrees.

Retorna: constraint, values.

physics.set_constraint_linear_z_limit (risco 2, altera, requer mundo, smoke)​

Sem descrição.

ArgumentoTipoDescrição
motionstringobrigatório. free, limited, or locked.
limitnumberobrigatório. Limit distance cm or angle degrees.

Retorna: constraint, values.

physics.set_constraint_swing1_limit (risco 2, altera, requer mundo, smoke)​

Sem descrição.

ArgumentoTipoDescrição
motionstringobrigatório. free, limited, or locked.
limitnumberobrigatório. Limit distance cm or angle degrees.

Retorna: constraint, values.

physics.set_constraint_swing2_limit (risco 2, altera, requer mundo, smoke)​

Sem descrição.

ArgumentoTipoDescrição
motionstringobrigatório. free, limited, or locked.
limitnumberobrigatório. Limit distance cm or angle degrees.

Retorna: constraint, values.

physics.set_constraint_twist_limit (risco 2, altera, requer mundo, smoke)​

Sem descrição.

ArgumentoTipoDescrição
motionstringobrigatório. free, limited, or locked.
limitnumberobrigatório. Limit distance cm or angle degrees.

Retorna: constraint, values.

physics.set_material (risco 2, altera, smoke)​

Updates portable physical response values of a PhysicalMaterial asset.

ArgumentoTipoDescrição
frictionstringDynamic friction, non-negative.
staticFrictionstringStatic friction, non-negative.
restitutionstringBounciness from zero through one.
densitystringDensity in grams per cubic centimetre, non-negative.
surfaceTypestringSurface type number (0..62).
overrideFrictionCombineModestringOverride friction combination mode.
frictionCombineModestringFriction combination: average, min, multiply, or max.
overrideRestitutionCombineModestringOverride restitution combination mode.
restitutionCombineModestringRestitution combination: average, min, multiply, or max.

Retorna: material, friction, staticFriction, restitution, density, surfaceType, overrideFrictionCombineMode, frictionCombineMode, overrideRestitutionCombineMode, restitutionCombineMode.

physics.set_project_settings (risco 4, altera)​

Saves selected project physics timing defaults to DefaultEngine.ini.

ArgumentoTipoDescrição
substeppingstringEnable synchronous physics substepping.
substeppingAsyncstringEnable asynchronous physics substepping where supported.
maxPhysicsDeltaTimestringMaximum simulation delta in seconds, greater than zero.
maxSubstepDeltaTimestringMaximum substep delta in seconds, greater than zero.
maxSubstepsstringMaximum substeps, from 1 through 16.
defaultDegreesOfFreedomstringDefault degree-of-freedom mode: full3d, yz, xz, or xy.

Retorna: values, surfaces, channels, message.

physics.set_surface_types (risco 4, altera)​

Saves named physical-surface types to DefaultEngine.ini.

ArgumentoTipoDescrição
surfacesarray of UeaPhysicsSurfaceobrigatório. Surface names to create or update.

Retorna: values, surfaces, channels, message.

physics.sleep_body (risco 2, altera, requer PIE, smoke)​

Sem descrição.

ArgumentoTipoDescrição
actorstringobrigatório. Actor label, name, or path in the editor or PIE world.
componentstringPrimitive component name; empty selects the first primitive component.

Retorna: actor, component, values, message.

physics.spawn_body_actor (risco 2, altera, requer mundo, smoke)​

Spawns a movable StaticMeshActor (default engine cube) in the editor world, optionally simulating physics.

ArgumentoTipoDescrição
labelstringobrigatório. Actor label for the new actor.
meshstringStatic mesh asset; defaults to the engine cube. Padrão TEXT("/Engine/BasicShapes/Cube").
location{x,y,z}World location in centimetres.
simulatebooleanEnable physics simulation on the mesh component. Padrão false.

Retorna: actor, component, values, message.

physics.spawn_constraint_actor (risco 2, altera, requer mundo, smoke)​

Spawns a PhysicsConstraintActor in the editor world joining actor1 and actor2 (empty = world). Its component is MyConstraintComp.

ArgumentoTipoDescrição
labelstringobrigatório. Actor label for the new constraint actor.
actor1stringFirst constrained actor label/name; empty constrains to the world.
actor2stringSecond constrained actor label/name; empty constrains to the world.
location{x,y,z}World location in centimetres.

Retorna: constraint, values.

physics.spawn_test_body (risco 1, requer PIE, smoke)​

Spawns a transient simulated StaticMeshActor in the running PIE world for force/velocity experiments.

ArgumentoTipoDescrição
labelstringobrigatório. Actor label for the new actor.
meshstringStatic mesh asset; defaults to the engine cube. Padrão TEXT("/Engine/BasicShapes/Cube").
location{x,y,z}World location in centimetres.
simulatebooleanEnable physics simulation on the mesh component. Padrão false.

Retorna: actor, component, values, message.

physics.spawn_test_constraint (risco 1, requer PIE, smoke)​

Spawns a transient PhysicsConstraintActor in the running PIE world and initialises it between actor1 and actor2 (empty = world).

ArgumentoTipoDescrição
labelstringobrigatório. Actor label for the new constraint actor.
actor1stringFirst constrained actor label/name; empty constrains to the world.
actor2stringSecond constrained actor label/name; empty constrains to the world.
location{x,y,z}World location in centimetres.

Retorna: constraint, values.

physics.sweep (risco 0, requer PIE, smoke)​

Sweeps a sphere, box, or capsule for the first blocking hit in the active PIE world.

ArgumentoTipoDescrição
shapestringShape kind: sphere, box, or capsule. Padrão TEXT("sphere").
start{x,y,z}obrigatório. Start / overlap centre in centimetres.
end{x,y,z}Sweep end in centimetres; ignored by overlap.
radiusnumberSphere radius, capsule radius, or box X half extent in centimetres. Padrão 50.0.
halfHeightnumberCapsule half-height or box Y half extent in centimetres. Padrão 50.0.
extentZnumberBox Z half extent in centimetres. Padrão 50.0.
rotation{x,y,z}Shape rotation in degrees for box and capsule queries.

Retorna: hit, hit, message.

physics.wake_body (risco 2, altera, requer PIE, smoke)​

Sem descrição.

ArgumentoTipoDescrição
actorstringobrigatório. Actor label, name, or path in the editor or PIE world.
componentstringPrimitive component name; empty selects the first primitive component.

Retorna: actor, component, values, message.