Skip to content
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

[BETA] ESM Multi-Camera script updates #7078

Merged
merged 7 commits into from
Oct 30, 2024
Merged

[BETA] ESM Multi-Camera script updates #7078

merged 7 commits into from
Oct 30, 2024

Conversation

kpal81xd
Copy link
Contributor

@kpal81xd kpal81xd commented Oct 30, 2024

N.B. This script is currently in beta and not finalized

  • Updated base-camera and multi-camera from model viewer
  • Changed multi-camera root entity to be entity holding camera
  • Removed requirements for setting attributes for basic use

Usage

import { MultiCamera } from 'playcanvas/scripts/camera/multi-camera.js';
// ...
const camera = new Entity('camera');
camera.addComponent('script');
const script = camera.script.create(MultiCamera);

// optional: set scene size
script.sceneSize = 100

// focus
const point = new Vec3(0, 0, 0);
script.focus(point);
// or
const start = new Vec3(0, 20, 20);
script.focus(point, start);

// zoom
script.resetZoom(start.distance(point));

@kpal81xd kpal81xd self-assigned this Oct 30, 2024
@kpal81xd kpal81xd requested a review from a team October 30, 2024 14:31
@kpal81xd kpal81xd changed the title Multi-Camera script updates [BETA] ESM Multi-Camera script updates Oct 30, 2024
@kpal81xd kpal81xd merged commit fb685f2 into main Oct 30, 2024
7 of 8 checks passed
kpal81xd added a commit that referenced this pull request Oct 30, 2024
* Converted camera entity to camera component

* Reorganised class attributes and removed target

* Reimported script from model viewer and attached script to camera

* Added zoom reset flag to example

* Name refactor

* Added error handling to script

* Used distance instead of length

/**
* @attribute
* @type {number}
* @type {Vec2}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add one line description to these attributes. They'll be picked up by the editor as tooltip descriptions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants