Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aframe-ball-blaster

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aframe-ball-blaster

Simple blaster that shoots balls, for A-Frame

  • 0.0.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Overview

A simple gun that blasts small yellow balls. Useful for testing / demoing physics scenes.

Compatible with:

  • aframe-physics-system (Cannon & Ammo drivers)
  • physx for A-Frame

image-20230701171702787

Two components are provided, both with the same schema:

  • ball-blaster intended for use directly in a scene
  • controller-ball-blaster intended for use as a child of a controller. This component includes some additional functionality to appear when the controller is instantiated (e.g. on entering VR) and disappear when the controller disappears (e.g. on exiting VR)

Schema

Both components have the same schema:

PropertyDescriptionDefault
velocityVelocity of balls in m/s20
radiusRadius of balls, in m0.05
ballColorThe color of the ballsyellow
blasterColorThe color of the blaster#333 (dark grey)
debugEnables detailed console logging of ball speed and position, useful for debugging issuesfalse

The components automatically detects any supported physics system configured on the scene, and applies appropriate physics configuration.

When PhysX is used, Continuous Collision Detection is configured (this is unsupported in Cannon and Ammo).

Usage

A blaster that shoots slow balls (1m/s)

<a-entity position='-0.5 1.5 -1' rotation='20 -20 0' ball-blaster="velocity: 1">
</a-entity>

A blaster held in a player's right hand (with desktop-vr-controller simulation of the hand when running on desktop).

      <a-entity id="right-hand"
                hand-controls="hand: right" 
                position="0.4 1.4 -0.5"
                rotation="45 0 0"
                desktop-vr-controller>
        <a-entity controller-ball-blaster rotation="-80 0 0" position="-0.02 0 -0.01"></a-entity>
      </a-entity>

Installation

Via CDN

<script src="https://cdn.jsdelivr.net/npm/aframe-ball-blaster@0.0.1/index.min.js"></script>

Or via npm

npm install aframe-ball-blaster

Examples

This component is used in tests for the xr-room-physics component, for example:

ammo-desktop-room5.html

See also tests for each supported physics engine:

ammo-blaster.html

cannon-blaster.html

physx-blaster.html

Futures

At some point I would like to add the following (PRs welcome!)

  • sound effects when projectiles collide with other entities

  • haptic feedback when shooting in VR

Code

ball-blaster

FAQs

Package last updated on 11 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc