Skip to content
MrAndroPCPublic

About

This is a KSA Early Alpha tool for placement thrusters and their directions over 3D .GLB models and transforming this data into game-supported XML format.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

ย 

History

10 Commits

Folders and files

Repository files navigation

KSA Thruster Placement Tool (TPT)

VersionLicense ReactThree.jsTypeScript

3D editor for spacecraft thruster placement and configuration

Live Demo โ€ข Report Bug โ€ข Request Feature

Overview

KSA-TPT is a web-based 3D editor designed for in the KSA (Kitten Space Agency) Pre-Alpha. It provides a visual interface for placing, orienting, and configuring RCS thrusters on 3D models, then exporting their configuration to KSA-compatible XML format.

Key Capabilities

  • Visual 3D Editing - Interactive placement and rotation of thrusters with real-time visual feedback
  • GLB Model Support - Import and visualize your spacecraft models in glTF binary format
  • Precision Controls - Fine-tune thruster positions and directions with numerical inputs
  • Thruster Configuration - Set thrust values, specific impulse, and other physical parameters
  • Transform Modes - Switch between translate and rotate modes with keyboard shortcuts (T/R)
  • XML Export - Generate game-ready XML configuration files

Features

3D Viewport

  • Interactive 3D canvas powered by Three.js and React Three Fiber
  • Orbit controls with smooth damping for easy navigation
  • Axis-aligned views - Snap to front, back, left, right, top, or bottom views
  • Grid and axis helpers for spatial reference
  • Real-time gizmo visualization showing thruster positions and exhaust directions

Thruster Management

  • Add/Remove thrusters with instant visual feedback
  • Duplicate thrusters to speed up symmetric configurations
  • Visual gizmos - Orange spheres with yellow directional cones
  • Transform controls - Interactive translate and rotate gizmos
  • Properties panel with comprehensive parameter editing

Editing Tools

  • Position editing - X, Y, Z coordinates with 0.001m precision
  • Direction editing - Exhaust vector control with visual feedback
  • Transform modes - Translate (T) and Rotate (R) with keyboard shortcuts
  • Snap-to-axis views - Quick orthogonal camera positioning
  • Reset rotation - One-click return to default orientation

Export & Integration

  • ๐Ÿ“‹ One-click XML export to clipboard
  • ๐ŸŽฎ Game-compatible format with proper coordinate mapping
  • โš™๏ธ Full parameter support including:
    • Thrust (Newtons)
    • Specific Impulse (seconds)
    • Minimum pulse time
    • Control mappings
    • Volumetric exhaust effects
    • Sound events

Getting Started

Prerequisites

  • Node.js 18.x or higher
  • npm 9.x or higher (or pnpm / yarn)

Installation

  1. Clone the repository

    git clone https://github.com/MrAndroPC/KSA-TPT.git
    cd KSA-TPT
  2. Install dependencies

    npm install
  3. Start development server

    npm run dev
  4. Open your browser

    http://localhost:5173
    

Build for Production

npm run build
npm run preview  # Preview production build locally

Deploy to GitHub Pages

npm run deploy

Usage Guide

Basic Workflow

  1. Import a Model

    • Drag and drop a .glb file into the import zone, or click to browse
    • Your 3D model will appear in the viewport
  2. Add Thrusters

    • Click the "+ Add" button to create a new thruster
    • The thruster appears at the origin with default properties
  3. Position Thrusters

    • Select a thruster from the list
    • Press T for translate mode or R for rotate mode
    • Use the 3D gizmo to move and rotate the thruster
    • Or manually enter coordinates in the properties panel
  4. Configure Properties

    • Set the thruster ID and control mapping (e.g., "TranslateRight")
    • Adjust thrust, specific impulse, and pulse time
    • Configure visual effects and sound events
  5. Export Configuration

    • Click "Copy XML" to copy the configuration to clipboard
    • Paste into your game's configuration file

Keyboard Shortcuts

Key Action
T Switch to Translate mode
R Switch to Rotate mode
Click Axis Gizmo Snap to orthogonal view
Click Axis Again Flip to opposite view

Coordinate System

  • X-axis (Red) - Front/Back (Game forward is +X)
  • Y-axis (Green) - Right/Left
  • Z-axis (Blue) - Up/Down

Exhaust Direction: The yellow cone shows the exhaust direction. For a thruster to push the spacecraft forward, the exhaust should point backward (toward -X by default).


Technical Stack

Core Technologies

Technology Version Purpose
React 19.2.0 UI framework
TypeScript 5.9.3 Type safety
Vite 7.2.2 Build tool & dev server
Three.js 0.181.1 3D rendering engine
React Three Fiber 9.4.0 React renderer for Three.js
@react-three/drei 10.7.7 Three.js helpers & controls
Zustand 5.0.8 State management
fast-xml-parser 5.3.2 XML serialization

Development Tools

  • ESLint - Code linting with TypeScript support
  • gh-pages - Automated GitHub Pages deployment

Project Structure

KSA-TPT/
โ”œโ”€โ”€ public/               # Static assets
โ”‚   โ””โ”€โ”€ vite.svg
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ assets/          # Images and icons
โ”‚   โ”‚   โ””โ”€โ”€ react.svg
โ”‚   โ”œโ”€โ”€ components/      # React components
โ”‚   โ”‚   โ”œโ”€โ”€ AxisGizmo.tsx           # Axis view controller
โ”‚   โ”‚   โ”œโ”€โ”€ ExportXmlPanel.tsx      # XML export interface
โ”‚   โ”‚   โ”œโ”€โ”€ ImportDropZone.tsx      # Model import
โ”‚   โ”‚   โ”œโ”€โ”€ LoadedModel.tsx         # 3D model renderer
โ”‚   โ”‚   โ”œโ”€โ”€ ModelInfoPanel.tsx      # Model information display
โ”‚   โ”‚   โ”œโ”€โ”€ SceneRoot.tsx           # Main 3D scene
โ”‚   โ”‚   โ”œโ”€โ”€ ThrusterGizmo.tsx       # Individual thruster visualization
โ”‚   โ”‚   โ”œโ”€โ”€ ThrusterListPanel.tsx   # Thruster list UI
โ”‚   โ”‚   โ”œโ”€โ”€ ThrusterPropertiesForm.tsx  # Properties editor
โ”‚   โ”‚   โ”œโ”€โ”€ ThrustersGizmos.tsx     # All thrusters renderer
โ”‚   โ”‚   โ”œโ”€โ”€ TransformModeToolbar.tsx    # Mode switcher
โ”‚   โ”‚   โ””โ”€โ”€ ViewportCanvas.tsx      # 3D viewport container
โ”‚   โ”œโ”€โ”€ lib/             # Core logic
โ”‚   โ”‚   โ”œโ”€โ”€ thrusterSchema.ts       # Data models
โ”‚   โ”‚   โ””โ”€โ”€ xmlSerializer.ts        # XML export logic
โ”‚   โ”œโ”€โ”€ state/           # State management
โ”‚   โ”‚   โ”œโ”€โ”€ editorStore.ts          # Editor state (modes, views)
โ”‚   โ”‚   โ”œโ”€โ”€ modelStore.ts           # 3D model state
โ”‚   โ”‚   โ””โ”€โ”€ thrustersStore.ts       # Thrusters data
โ”‚   โ”œโ”€โ”€ App.tsx          # Root component
โ”‚   โ”œโ”€โ”€ main.tsx         # Application entry
โ”‚   โ””โ”€โ”€ index.css        # Global styles
โ”œโ”€โ”€ index.html           # HTML template
โ”œโ”€โ”€ package.json         # Dependencies
โ”œโ”€โ”€ tsconfig.json        # TypeScript config
โ”œโ”€โ”€ vite.config.ts       # Vite configuration
โ””โ”€โ”€ README.md           # This file

TypeScript Configuration

Strict type checking is enabled for maximum code quality. See tsconfig.json and tsconfig.app.json.

ESLint Configuration

Modern flat config format with React and TypeScript rules. See eslint.config.js.


Contributing

Contributions are welcome! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch
    git checkout -b feature/amazing-feature
  3. Commit your changes
    git commit -m 'Add some amazing feature'
  4. Push to the branch
    git push origin feature/amazing-feature
  5. Open a Pull Request

Development Guidelines

  • Follow the existing code style
  • Add TypeScript types for all new code
  • Test your changes thoroughly
  • Update documentation as needed

Known Issues

  • Y and Z coordinates are intentionally swapped in some places in code
  • Large models are loading quite a long time
  • You can't move your cursor when you trying to enter orthgrapic view

๐Ÿ™ Acknowledgments

  • Three.js community for the excellent 3D library
  • React Three Fiber for the React integration
  • KSA community for inspiration and testing

Project Link: https://github.com/MrAndroPC/KSA-TPT


โญ Star this repository if you find it helpful!

Made with โค๏ธ for the KSA Modding Community

About

This is a KSA Early Alpha tool for placement thrusters and their directions over 3D .GLB models and transforming this data into game-supported XML format.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages