decentraland-scenes / Swimming-shark

A shark moves along a curve, smoothly rotating and varying its speed depending on steepness

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Swimming shark

A scene that shows a shark moving around in circles along a curved circular path, using lerp over each segment of the path.

This scene shows you:

  • How to trace a curve made up of multiple segments
  • How to use a system to move an entity through the points of the curve
  • How to use a system to keep rotating the entity towards the next point in the path
  • How to create custom components to store custom data

The path is generated by specifying just four points through which the shark needs to pass, the rest of the points are calculated automatically.

The shark also rotates smoothly with a spherical lerp function. It's speed also depends on the steepness of the segment it's swimming up. The speed and intensity of the swimming animation also depends on this.

Try it out

Install the CLI

Download and install the Decentraland CLI by running the following command:

npm i -g decentraland

Previewing the scene

Download this example and navigate to its directory, then run:

$:  dcl start

Any dependencies are installed and then the CLI opens the scene in a new browser tab.

Scene Usage

The shark moves following a fixed path. Its speed depends on the steepness of the section it's swimming through.

Learn more about how to build your own scenes in our documentation site.

If something doesn’t work, please file an issue.

Copyright info

This scene is protected with a standard Apache 2 licence. See the terms and conditions in the LICENSE file.

About

A shark moves along a curve, smoothly rotating and varying its speed depending on steepness

License:Apache License 2.0


Languages

Language:TypeScript 91.8%Language:Dockerfile 8.2%