Skip to content

Fix links and grammar in docs #199

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const useRenderOnCameraChange = (entity: PcEntity | null) => {
}, [app]);

/**
* This hook ensures that rendering only happens when the camera has moved or it's projection has changed.
* This hook ensures that rendering only happens when the camera has moved or its projection has changed.
* However if the canvas is not visible on the page it will take precedence.
* Don't render if the canvas is not visible regardless of any animations.
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/content/docs/api/components/align.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Align

The `Align` component is a simple container that positions an entity relative to it's parent. This can be useful when using 3D assets that are offset from the origin. Sometimes, you just want to sit the asset on the ground, or align it with the camera.
The `Align` component is a simple container that positions an entity relative to its parent. This can be useful when using 3D assets that are offset from the origin. Sometimes, you just want to sit the asset on the ground, or align it with the camera.

The `Align` component accepts the following props `top` | `bottom` | `left` | `right` | `front` | `back`.

Expand Down
4 changes: 2 additions & 2 deletions packages/docs/content/docs/api/components/anim.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ openGraph:
### asset
The asset to use for the animation.

Type: [`Asset`](https://api.playcanvas.com/classes/Engine.Asset.html)
Type: [`Asset`](https://api.playcanvas.com/engine/classes/Asset.html)

### clip
The name of the animation clip to play.
Expand All @@ -31,7 +31,7 @@ Default: `false`

### Additional Props

Any additional props will be passed to the PlayCanvas AnimComponent class directly. See the [PlayCanvas documentation](https://api.playcanvas.com/classes/Engine.AnimComponent.html) for more information. */}
Any additional props will be passed to the PlayCanvas AnimComponent class directly. See the [PlayCanvas documentation](https://api.playcanvas.com/engine/classes/AnimComponent.html) for more information. */}

## Usage

Expand Down
2 changes: 1 addition & 1 deletion packages/docs/content/docs/api/components/camera.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const CameraExample = () => {
}
```

Learn more about the [Camera Component](https://api.playcanvas.com/classes/Engine.CameraComponent.html) in the PlayCanvas documentation.
Learn more about the [Camera Component](https://api.playcanvas.com/engine/classes/CameraComponent.html) in the PlayCanvas documentation.

## Props

Expand Down
6 changes: 3 additions & 3 deletions packages/docs/content/docs/api/components/collision.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ openGraph:
---
# Collision

The `Collision` component attaches a PlayCanvas [Collision Component](https://api.playcanvas.com/classes/Engine.CollisionComponent.html) to an [`Entity`](/docs/api/entity).
The `Collision` component attaches a PlayCanvas [Collision Component](https://api.playcanvas.com/engine/classes/CollisionComponent.html) to an [`Entity`](/docs/api/entity).

It allows an [`Entity`](/docs/api/entity) to participate in collision detection with other entities that have collision components. This is useful for physics simulations, trigger zones, and other gameplay mechanics that require detecting when objects intersect.

> [!NOTE]
>
> Enable physics by installing `npm i sync-ammo` and enabling physics on the Application using `<Application usePhysics/>`.

Learn more about Collision components in the [PlayCanvas documentation](https://api.playcanvas.com/classes/Engine.CollisionComponent.html). Also see the [Rigidbody](/api/components/rigidbody) component for more information on how to use collision components with physics.
Learn more about Collision components in the [PlayCanvas documentation](https://api.playcanvas.com/engine/classes/CollisionComponent.html). Also see the [Rigidbody](/api/components/rigidbody) component for more information on how to use collision components with physics.

## Usage

Expand All @@ -39,7 +39,7 @@ const CollisionExample = () => {

## Props

The following props are based on the [Collision API](https://developer.playcanvas.com/en/api/pc.CollisionComponent.html) from PlayCanvas version **<PcVersion />**. This documentation is automatically generated from the TypeScript types of the installed PlayCanvas package.
The following props are based on the [Collision API](https://api.playcanvas.com/engine/classes/CollisionComponent.html) from PlayCanvas version **<PcVersion />**. This documentation is automatically generated from the TypeScript types of the installed PlayCanvas package.

<TSDoc
code={`import type { Collision } from '@playcanvas/react/components'
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/content/docs/api/components/envatlas.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const EnvAtlasExample = () => {

## Props

The following props are based on the [EnvAtlas Component](https://api.playcanvas.com/engine/classes/EnvAtlasComponent.html) from PlayCanvas version **<PcVersion />**. This documentation is automatically generated from the TypeScript types of the installed PlayCanvas package.
The following props are based on the [Scene API](https://api.playcanvas.com/engine/classes/Scene.html) from PlayCanvas version **<PcVersion />**. This documentation is automatically generated from the TypeScript types of the installed PlayCanvas package.

<TSDoc
code={`import type { EnvAtlas } from '@playcanvas/react/components'
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/content/docs/api/components/rigidbody.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ openGraph:

# Rigidbody

The `Rigidbody` component enables physics for an [`Entity`](/docs/api/entity), allowing it to interact with the global physics simulation. You can apply forces, torques, and other physics behaviours to an entity with a `Rigidbody` component and it will respond accordingly.
The `Rigidbody` component enables physics for an [`Entity`](/docs/api/entity), allowing it to interact with the global physics simulation. You can apply forces, torques, and other physics behaviors to an entity with a `Rigidbody` component and it will respond accordingly.

> [!NOTE]
>
Expand Down
4 changes: 2 additions & 2 deletions packages/docs/content/docs/api/components/scripts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ openGraph:
---

# Script
The `Script` components provides a simple imperative way to add behaviours to an `Entity`.
The `Script` components provides a simple imperative way to add behaviors to an `Entity`.

This is useful for things like physics, animation, and interactivity where, for performance reasons, you want to bypass the updating React props. It allows you to hook into the engine's update loop outside of React, which is useful for performance-critical code. You can also leverage existing Scripts from PlayCanvas Editor Projects.

There's more information about [Scripts in the docs](https://developer.playcanvas.com/user-manual/scripting/).

## Usage

The `Script` component takes a class that extends the PlayCanvas [Script](https://api.playcanvas.com/classes/Engine.Script-1.html) class and attaches it to the `Entity`. Any additional props are passed to the Script class directly and can be used as properties on the class.
The `Script` component takes a class that extends the PlayCanvas [Script](https://api.playcanvas.com/engine/classes/Script.html) class and attaches it to the `Entity`. Any additional props are passed to the Script class directly and can be used as properties on the class.

In the example below, we create a simple script that rotates the entity every frame. The `update()` method is called every frame amd the speed prop is used as a class property. `this.entity` refers to the parent `Entity` the Script is attached to.

Expand Down
4 changes: 2 additions & 2 deletions packages/docs/content/docs/api/entity.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ export default function Scene() {
}
```

Entities on their own are not visible, they need components to have behaviour. You can add components to an entity by nesting them within the `Entity` component.
Entities on their own are not visible, they need components to have behavior. You can add components to an entity by nesting them within the `Entity` component.

## Props

The following props are based on the [Entity API](https://developer.playcanvas.com/en/api/pc.Entity.html) from PlayCanvas version **<PcVersion />**. This documentation is automatically generated from the TypeScript types of the installed PlayCanvas package.
The following props are based on the [Entity API](https://api.playcanvas.com/engine/classes/Entity.html) from PlayCanvas version **<PcVersion />**. This documentation is automatically generated from the TypeScript types of the installed PlayCanvas package.

<TSDoc
code={`import type { Entity } from '@playcanvas/react'
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/content/docs/api/hooks/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ There are a number of important hooks that are useful when working with `@playca

## useApp

The `useApp` hook returns the [`Application`](https://api.playcanvas.com/classes/Engine.Application.html) instance that is currently active. This is useful if you need reference to the PlayCanvas Application instance directly.
The `useApp` hook returns the [`Application`](https://api.playcanvas.com/engine/classes/Application.html) instance that is currently active. This is useful if you need reference to the PlayCanvas Application instance directly.

```jsx
import { useApp } from '@playcanvas/react/hooks'
Expand Down
14 changes: 7 additions & 7 deletions packages/docs/content/docs/api/hooks/use-asset.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ The `useAsset` hook has the following return type.

The following hooks are available:

- [`useModel`](/docs/api/hooks/assets#usemodel) - Load a 3D model asset
- [`useSplat`](/docs/api/hooks/assets#usesplat) - Load a Gaussian Splat asset
- [`useTexture`](/docs/api/hooks/assets#usetexture) - Load a texture asset
- [`useEnvAtlas`](/docs/api/hooks/assets#useenvatlas) - Load an environment atlas texture
- [`useAsset`](/docs/api/hooks/assets#useasset) - Generic hook for loading any type of asset
- [`useModel`](/docs/api/hooks/use-asset#usemodel) - Load a 3D model asset
- [`useSplat`](/docs/api/hooks/use-asset#usesplat) - Load a Gaussian Splat asset
- [`useTexture`](/docs/api/hooks/use-asset#usetexture) - Load a texture asset
- [`useEnvAtlas`](/docs/api/hooks/use-asset#useenvatlas) - Load an environment atlas texture
- [`useAsset`](/docs/api/hooks/use-asset#useasset) - Generic hook for loading any type of asset

## useModel

Expand Down Expand Up @@ -120,7 +120,7 @@ dracoInitialize({

## useSplat

A specialized hook for loading Gaussian Splat assets. Pass the source URL of the splat file and any additional properties to pass to the asset loader and use the resulting asset in the [`<GSplat/>`](/docs/api/components/GSplat) component.
A specialized hook for loading Gaussian Splat assets. Pass the source URL of the splat file and any additional properties to pass to the asset loader and use the resulting asset in the [`<GSplat/>`](/docs/api/components/splat) component.

```tsx copy filename="render-splat.tsx"
import { useSplat } from '@playcanvas/react/hooks';
Expand Down Expand Up @@ -159,7 +159,7 @@ export function RenderTexture() {
}
```

See the [useMaterial](/docs/api/hooks/assets/useMaterial) hook and [Render](/docs/api/components/Render) component for more information.
See the [useMaterial](/docs/api/hooks/use-asset/useMaterial) hook and [Render](/docs/api/components/Render) component for more information.

## useEnvAtlas

Expand Down
4 changes: 2 additions & 2 deletions packages/docs/content/docs/api/hooks/use-material.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ openGraph:

Materials are a fundamental part of 3D graphics. They define the appearance of 3D objects and are used to create realistic lighting effects. Materials can be applied to `Render` components to change the appearance of 3D objects. They accept a wide range of properties to control the appearance of the material.

The `useMaterial` hook returns a [`StandardMaterial`](https://api.playcanvas.com/classes/Engine.StandardMaterial.html) instance. This is useful if you need to create materials and apply them to `Render` components.
The `useMaterial` hook returns a [`StandardMaterial`](https://api.playcanvas.com/engine/classes/StandardMaterial.html) instance. This is useful if you need to create materials and apply them to `Render` components.

```jsx copy filename="use-material.jsx"
import { useMaterial } from '@playcanvas/react/hooks'
Expand Down Expand Up @@ -44,7 +44,7 @@ const RedGlowingBox = () => {

## Props

The `StandardMaterial` accepts many different props which can be found [here](https://api.playcanvas.com/classes/Engine.StandardMaterial.html).
The `StandardMaterial` accepts many different props which can be found [here](https://api.playcanvas.com/engine/classes/StandardMaterial.html).

{/* The following is the type definition for the StandardMaterial class. It's statically copied from the PlayCanvas engine. */}
<TSDoc
Expand Down
4 changes: 2 additions & 2 deletions packages/docs/content/docs/api/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Because this library wraps the live engine directly, **you get instant access to

The library is divided into a few main sections, each with its own purpose:

- `@playcanvas/react` — Core components like [`Application`](/docs/api/core/application) and [`Entity`](/docs/api/core/entity)
- `@playcanvas/react` — Core components like [`Application`](/docs/api/application) and [`Entity`](/docs/api/entity)
- `@playcanvas/react/components` — Scene components such as [`Render`](/docs/api/components/render), [`Camera`](/docs/api/components/camera), [`Light`](/docs/api/components/light)
- `@playcanvas/react/hooks` — Hooks to interact with the runtime (e.g. [`useApp`](/docs/api/hooks#useapp), [`useFrame`](/docs/api/hooks#useframe))
- `@playcanvas/react/utils` — Utility functions (e.g. [`fetchAsset`](/docs/api/utils/fetch-asset))
Expand Down Expand Up @@ -80,7 +80,7 @@ Transform-related props like `position`, `rotation`, and `scale` are passed as n
<Entity rotation={[0, 90, 0]}/>
<Entity scale={[1, 2, 1]}/>
```
See the [Entity](/docs/api/core/entity) component for more information.
See the [Entity](/docs/api/entity) component for more information.



Expand Down
8 changes: 2 additions & 6 deletions packages/docs/content/docs/guide/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ npm install @playcanvas/react playcanvas@latest
npm run dev
```

If this goes smoothly, you'll see some default vite content in your browser.
If this goes smoothly, you'll see some default Vite content in your browser.

### Your first 3D project

Expand Down Expand Up @@ -117,7 +117,7 @@ We've added an entity with a `Camera` component to the scene. Also, we've set th

### Adding interactivity

On it's own, this isn't very exciting. Let's add some interactivity by adding a `Script` component so you can rotate the cube with the mouse.
On its own, this isn't very exciting. Let's add some interactivity by adding a `Script` component so you can rotate the cube with the mouse.

```jsx copy filename="src/App.jsx" {10}
import './App.css'
Expand Down Expand Up @@ -201,7 +201,3 @@ export default function App() {
```

We now have a complete 3D scene with a camera, a rotating model, and some environment lighting. You can now start adding your own assets and creating your own scenes. Check out the [next section](/docs/guide/loading-assets) to learn how to load your own assets and adding interactivity with scripts.




12 changes: 6 additions & 6 deletions packages/docs/content/docs/guide/loading-assets.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { Callout } from 'nextra/components'

Assets are a core part of any 3D application, and they can also take a significant amount time to load, which can make your app feel sluggish. Knowing how to load and manage assets efficiently is key to a smooth user experience.

`@playcanvas/react` provides a set of specialized hooks for loading different types of assets, as well as a utility function for loading assets. For detailed API documentation, see the [Asset Hooks reference](/docs/api/hooks/assets)
`@playcanvas/react` provides a set of specialized hooks for loading different types of assets, as well as a utility function for loading assets. For detailed API documentation, see the [Asset Hooks reference](/docs/api/hooks/use-asset)

## Basic Usage

Expand Down Expand Up @@ -74,11 +74,11 @@ const { asset } = useTexture('texture.jpg', {

There are different hooks for loading different types of assets. You can create more advanced hooks by wrapping the `useAsset` hook.

- [`useModel`](/docs/api/hooks/assets#usemodel) for loading 3D GLTF/GLB models
- [`useTexture`](/docs/api/hooks/assets#usetexture) for loading textures
- [`useSplat`](/docs/api/hooks/assets#usesplat) for loading splat maps
- [`useEnvAtlas`](/docs/api/hooks/assets#useenvatlas) for loading environment atlases
- [`useAsset`](/docs/api/hooks/assets#useasset) for loading any type of asset
- [`useModel`](/docs/api/hooks/use-asset#usemodel) for loading 3D GLTF/GLB models
- [`useTexture`](/docs/api/hooks/use-asset#usetexture) for loading textures
- [`useSplat`](/docs/api/hooks/use-asset#usesplat) for loading splat maps
- [`useEnvAtlas`](/docs/api/hooks/use-asset#useenvatlas) for loading environment atlases
- [`useAsset`](/docs/api/hooks/use-asset#useasset) for loading any type of asset

## Advanced Patterns

Expand Down
4 changes: 2 additions & 2 deletions packages/docs/content/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import Example from '@templates/HomePageExample'
import Image from 'next/image'

<h1 className='text-4xl font-bold mt-8 mb-4'>
Playcanvas React
PlayCanvas React
</h1>

<div className='text-lg font-semibold text-muted-foreground'>
Expand Down Expand Up @@ -193,4 +193,4 @@ Developers and studios are already using **@playcanvas/react** in production

- ⚡ [Snap AI](https://ai.snapchat.com) uses **@playcanvas/react** to build real-time 3D interfaces inside their next-gen tools.
- [GSplat Share](https://gsplat.org/) – Share your splats with optional time-limited and password-protected links.
- ✨ Your project here? [Submit a PR](https://github.com/playcanvas/react/compare) and we’ll feature it below.
- ✨ Your project here? [Submit a PR](https://github.com/playcanvas/react/compare) and we’ll feature it below.
4 changes: 2 additions & 2 deletions packages/docs/content/faq.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ openGraph:
height: 630
---

# FAQ's
# FAQ
PlayCanvas is a 3D engine, @playcanvas/react is a library for building 3D apps with PlayCanvas. Most of the time you will use @playcanvas/react in your project and you won't need to worry about the PlayCanvas engine. However any PlayCanvas feature or class is available to you if you need it.
PlayCanvas is built on the concept of Entities and Components (ECS). Entities are nodes in the scene graph and Components are the features of those nodes. They add functionality to entities. This fits well with React's declarative approach to building UIs.

## Is this a replacement for the PlayCanvas Editor?
No, this is not a replacement for the PlayCanvas Editor. It's an alternative way to build projects using web tooling.

## How does this compare to react-three-fiber?
Conceptually it's similar to [react-three-fiber](https://github.com/pmndrs/react-three-fiber). However PlayCanvas has an ECS that include a wider set of features meaning features such as physics, gaussian splats, and more are available out of the box.
Conceptually, it's similar to [react-three-fiber](https://github.com/pmndrs/react-three-fiber). However, PlayCanvas has an ECS that include a wider set of features meaning features such as physics, gaussian splats, and more are available out of the box.

## Is this a react renderer?
No, not currently, although work is underway to [implement a the react renderer](https://github.com/playcanvas/react/pull/35). At the moment, it's simply a thin wrapper around the PlayCanvas engine, surfacing the PlayCanvas API as a react component library.
4 changes: 2 additions & 2 deletions packages/lib/.playcanvas-react.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ alwaysApply: true
```tsx
// Core
import { Application, Entity } from '@playcanvas/react'
// /components add behaviours to Entities
import { Light, Camera, Render, Gsplat, Screen, Collision, RigigBody, Anim } from '@playcanvas/react/components'
// Components add behaviors to Entities
import { Light, Camera, Render, Gsplat, Screen, Collision, RigidBody, Anim } from '@playcanvas/react/components'
// Hooks add functionality
import { useModel, useSplat, useAppEvent, useParent, useApp } from '@playcanvas/react/hooks'
```
Expand Down
Loading