entities

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2025 License: GPL-3.0 Imports: 8 Imported by: 0

README

entities

Entity definitions and management system for rocket simulation using the entity-component architecture.

Notes

  • Implements core entity definitions (rockets, launch pads, etc.)
  • Aggregates components to build complete functional entities
  • Provides entity creation and initialization methods
  • Manages entity lifecycle through simulation phases
  • Calculates complex entity properties based on component data
  • Maintains physical properties like mass, center of gravity
  • Ensures proper component relationships and dependencies
  • Supports runtime querying and modification of entity attributes

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InertialComponent added in v0.8.0

type InertialComponent interface {
	GetMass() float64
	GetPosition() types.Vector3             // Position of the component's reference point in rocket global axes
	GetCenterOfMassLocal() types.Vector3    // Position of the component's CM relative to its reference point, in component local axes
	GetInertiaTensorLocal() types.Matrix3x3 // Inertia tensor of component about its own CM, in component local axes
}

InertialComponent defines an interface for components that contribute to mass and inertia.

type PhysicsStateConfig added in v0.8.0

type PhysicsStateConfig struct {
	OverallRocketCG               types.Vector3
	TotalInertiaTensorBody        types.Matrix3x3
	InverseTotalInertiaTensorBody types.Matrix3x3
	InitialMass                   float64
	Motor                         *components.Motor
	Bodytube                      *components.Bodytube
	Nosecone                      *components.Nosecone
	Finset                        *components.TrapezoidFinset
	Parachute                     *components.Parachute
}

PhysicsStateConfig holds parameters for creating a PhysicsState.

type RocketEntity

type RocketEntity struct {
	*ecs.BasicEntity
	*states.PhysicsState
	*types.Mass // This will store the initial total mass for reference
	// contains filtered or unexported fields
}

RocketEntity represents a complete rocket with all its components

func NewRocketEntity

func NewRocketEntity(world *ecs.World, orkData *openrocket.OpenrocketDocument, motor *components.Motor, log *logf.Logger) *RocketEntity

NewRocketEntity creates a new rocket entity from OpenRocket data and a motor. It initializes physical properties, components, CG, and inertia.

func (*RocketEntity) GetComponent

func (r *RocketEntity) GetComponent(name string) interface{}

AddComponent adds a component to the entity

func (*RocketEntity) GetCurrentMassKg added in v0.8.0

func (r *RocketEntity) GetCurrentMassKg() float64

GetCurrentMassKg calculates the current total mass of the rocket by summing the masses of its components. It pays special attention to components that implement InertialComponent (like the motor) to get their current mass.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL