Skip to main content

Introduction

The Actor system is what brings your Poly Plaza world to life! Every object in the game - from characters to buildings to items - is an Actor. This guide will show you how to control them.

Core Methods

Basic Information

GetName()

Returns the name of the Actor.

GetClassName()

Returns the class type of the Actor.

Location & Movement

GetLocation()

Returns the Actor’s current position in the world.

SetLocation(position)

Moves the Actor to a new position.

Rotation Control

GetRotation()

Gets the Actor’s current rotation.

SetRotation(rotation)

Sets the Actor’s rotation.

Scale & Size

GetScale()

Returns the Actor’s current scale.

Physics Controls

SetPhysicsEnabled(enable)

Enables or disables physics simulation.

GetPhysicsEnabled()

Checks if physics is enabled.

SetCollisionEnabled(enable)

Enables or disables collision detection.

GetCollisionEnabled()

Checks if collision is enabled.

Physics Properties

GetMass()

Gets the Actor’s mass in kilograms.

SetMass(mass)

Sets the Actor’s mass.

GetGravity()

Checks if gravity affects this Actor.

SetGravity(enable)

Enables or disables gravity for this Actor.

Physics Forces

AddImpulse(force)

Applies an instant force to the Actor.

GetVelocity()

Gets the Actor’s current velocity.

Actor Lifecycle

Destroy()

Removes the Actor from the world.

Advanced Examples

Creating a Physics Playground

Creating a Floating Display Item

Best Practices

Always check if your actor still exists before calling methods on it:
Be careful with physics forces! Start with small values and adjust as needed.
When working with multiple actors, consider disabling physics and collision for actors that don’t need them to improve performance.

Troubleshooting

Common Issues

  1. Actor not moving with AddImpulse
    • Check if physics is enabled
    • Verify the mass isn’t too high
    • Make sure gravity is appropriate for your needs
  2. Collision not working
    • Confirm collision is enabled
    • Check if physics is enabled
    • Verify the actor has a valid collision shape
  3. Actor disappearing
    • Make sure the location is within valid world bounds
    • Check if it was accidentally destroyed
    • Verify it hasn’t fallen through the world (check Z position)

Example Debug Function

Remember, actors are the building blocks of your Poly Plaza world. Use them wisely, and don’t forget to share your creations with the community!