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

aframe-ground-component

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aframe-ground-component

Infinite grounds for your A-Frame VR scene in just one file.

  • 0.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
24
increased by60%
Maintainers
1
Weekly downloads
 
Created
Source

aframe-ground-component

This component provides various sweet looking options for ground in an A-Frame VR scene (no sky, lights or dressings).

This is a fork of the aframe-environment-component by Feiss. The environment component is awesome, but sometimes dressings, sky and lighting is just not needed for your scene so I decided remove those other features and focus on a simpler version.

There are 2 new parameters to add more control over ground placement height (positionY)and scale (groundXZScale).

Make sure you are using A-Frame 0.9.2 or later. Then just include aframe-ground-component.js in your HTML:

  <script src="https://unpkg.com/aframe-ground-component@0.0.4/dist/aframe-ground-component.min.js"></script>

and add the ground component to an entity:

  <a-entity ground></a-entity>

That's it! :)

Presets

The previous code will setup a default scene, but you have a bunch of already predefined presets to choose from, using the preset parameter, like this:

  <a-entity ground="preset: <name of the preset>"></a-entity>

You can view and try all the presets in the aframe-ground-component Test Page. The current list of presets are listed in the next section.

Parameters

Apart from using a preset, you can tweak the ground with many parameters, like this:

  <a-entity ground="groundColor: #445"></a-entity>

You can also select a preset but change some of its parameters:

  <a-entity ground="preset: forest; groundColor: #445; grid: cross"></a-entity>

This is the list of the available parameters.

ParameterDefaultDescription
activetrueShow/hides the component. Use this instead of using the visible attribute
preset'default'Valid values: none, default, contact, egypt, checkerboard, forest, goaland, yavapai, goldmine, threetowers, poison, arches, tron, japan, dream, volcano, starry, osiris
seed1Seed for randomization. If you don't like the layout of the elements, try another value for the seed.
shadowfalseShadows on/off. Sky light casts shadows on the ground of all those objects with shadow component applied
shadowSize10Shadows size
flatShadingfalseWhether to show everything smoothed (false) or polygonal (true).
playArea1Radius of the area in the center reserved for the player and the gameplay. The ground is flat in there and no objects are placed inside.
ground'hills'Valid values: none, flat, hills, canyon, spikes, noise. Orography style.
groundYScale3Maximum height (in meters) of ground's features (hills, mountains, peaks..)
groundXZScale1Integer amount by which to scale the ground in X and Z axes
groundTexture'none'Valid values: none, checkerboard, squares, walkernoise
groundColor'#553e35'Main color of the ground
groundColor2'#694439'Secondary color of the ground. Used for textures, ignored if groundTexture is none
grid'none'Valid values: none, 1x1, 2x2, crosses, dots, xlines, ylines. 1x1 and 2x2 are rectangular grids of 1 and 2 meters side, respectively.
gridColor'#ccc'Color of the grid.
positionY0Specify custom height for ground
resolution64Specify the number of plane subdivisions (lower numbers reduce ground heightmap resolution and saves on triangle count)

The best way to work with them is to press ctrl-alt-i to open the inspector, search for 'ground' in the filter box and select it, and tweak the parameters while checking the changes in realtime. When you are happy, you can use the Copy attributes button or even better, copy the attributes logged in the browser's dev tools console.

Performance

This component removes all dressings used in environment component so it should perform better than the original environment component. To get even better performance reduce resolution down to a lower number.

Original Credit

This was originally written as environment component by @fiess at aframevr in Slack or Discord.

Keywords

FAQs

Package last updated on 26 Apr 2020

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